Skip to content

Commit 21f2680

Browse files
authored
Merge pull request #287 from grafana/update-upstream-prometheus
Update upstream prometheus
2 parents a632c73 + ae49ab5 commit 21f2680

95 files changed

Lines changed: 2996 additions & 562 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: ui_build_and_release
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v0.[0-9]+.[0-9]+*"
9+
jobs:
10+
release:
11+
name: release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Install nodejs
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version-file: "web/ui/.nvmrc"
20+
- uses: actions/cache@v3.0.4
21+
with:
22+
path: ~/.npm
23+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-node-
26+
27+
- name: Check libraries version
28+
## This step is verifying that the version of each package is matching the tag
29+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'v') }}
30+
run: ./scripts/ui_release.sh --check-package "${{ github.ref_name }}"
31+
- name: build
32+
run: make assets
33+
- name: Copy files before publishing libs
34+
run: ./scripts/ui_release.sh --copy
35+
- name: Publish dry-run libraries
36+
if: ${{ github.event_name == 'pull_request' || github.ref_name == 'main' }}
37+
run: ./scripts/ui_release.sh --publish dry-run
38+
- name: Publish libraries
39+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'v') }}
40+
run: ./scripts/ui_release.sh --publish
41+
env:
42+
# The setup-node action writes an .npmrc file with this env variable
43+
# as the placeholder for the auth token
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.promu.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ crossbuild:
3535
- illumos
3636
- linux
3737
- netbsd
38-
- openbsd
3938
- windows

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
# Changelog
22

3+
## 2.37.0-rc.0 / 2022-07-05
4+
5+
Following data loss by users due to lack of unified buffer cache in OpenBSD, we
6+
will no longer release Prometheus upstream for OpenBSD until a proper solution is
7+
found. #8799
8+
9+
* [FEATURE] Nomad SD: New service discovery for Nomad built-in service discovery. #10915
10+
* [ENHANCEMENT] Kubernetes SD: Allow attaching node labels for endpoint role. #10759
11+
* [ENHANCEMENT] PromQL: Optimise creation of signature with/without labels. #10667
12+
* [ENHANCEMENT] TSDB: Memory optimizations. #10873 #10874
13+
* [ENHANCEMENT] TSDB: Reduce sleep time when reading WAL. #10859 #10878
14+
* [BUGFIX] Alerting: Fix Alertmanager targets not being updated when alerts were queued. #10948
15+
* [BUGFIX] Hetzner SD: Make authentication files relative to Prometheus config file. #10813
16+
* [BUGFIX] Promtool: Fix `promtool check config` not erroring properly on failures. #10952
17+
* [BUGFIX] Scrape: Keep relabeled scrape interval and timeout on reloads. #10916
18+
* [BUGFIX] TSDB: Don't increment `prometheus_tsdb_compactions_failed_total` when context is canceled. #10772
19+
* [BUGFIX] TSDB: Fix panic if series is not found when deleting series. #10907
20+
* [BUGFIX] TSDB: Increase `prometheus_tsdb_mmap_chunk_corruptions_total` on out of sequence errors. #10406
21+
* [BUGFIX] Uyuni SD: Make authentication files relative to Prometheus configuration file and fix default configuration values. #10813
22+
23+
## 2.36.2 / 2022-06-20
24+
25+
* [BUGFIX] Fix serving of static assets like fonts and favicon. #10888
26+
327
## 2.36.1 / 2022-06-09
428

5-
* [BUGFIX] promtool: Add --lint-fatal option #10840
29+
* [BUGFIX] promtool: Add --lint-fatal option. #10840
630

731
## 2.36.0 / 2022-05-30
832

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ upgrade-npm-deps:
3939
@echo ">> upgrading npm dependencies"
4040
./scripts/npm-deps.sh "latest"
4141

42+
.PHONY: ui-bump-version
43+
ui-bump-version:
44+
version=$$(sed s/2/0/ < VERSION) && ./scripts/ui_release.sh --bump-version "$${version}"
45+
cd web/ui && npm install
46+
git add "./web/ui/package-lock.json" "./**/package.json"
47+
4248
.PHONY: ui-install
4349
ui-install:
4450
cd $(UI_PATH) && npm install

RELEASE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ Entries in the `CHANGELOG.md` are meant to be in this order:
144144
* `[ENHANCEMENT]`
145145
* `[BUGFIX]`
146146

147+
Then bump the UI module version:
148+
149+
```bash
150+
make ui-bump-version
151+
```
152+
147153
### 2. Draft the new release
148154

149155
Tag the new release via the following commands:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.36.1
1+
2.37.0-rc.0

cmd/prometheus/main_unix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestStartupInterrupt(t *testing.T) {
5454

5555
Loop:
5656
for x := 0; x < 10; x++ {
57-
// error=nil means prometheus has started so we can send the interrupt
57+
// error=nil means prometheus has started, so we can send the interrupt
5858
// signal and wait for the graceful shutdown.
5959
if _, err := http.Get(url); err == nil {
6060
startedOk = true

cmd/promtool/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ func CheckConfig(agentMode, checkSyntaxOnly bool, lintSettings lintConfig, files
344344
ruleFiles, err := checkConfig(agentMode, f, checkSyntaxOnly)
345345
if err != nil {
346346
fmt.Fprintln(os.Stderr, " FAILED:", err)
347+
hasErrors = true
347348
failed = true
348349
} else {
349350
if len(ruleFiles) > 0 {

cmd/promtool/main_test.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
package main
1515

1616
import (
17+
"errors"
1718
"fmt"
1819
"net/http"
1920
"net/http/httptest"
2021
"net/url"
2122
"os"
23+
"os/exec"
2224
"runtime"
2325
"strings"
26+
"syscall"
2427
"testing"
2528
"time"
2629

@@ -30,6 +33,21 @@ import (
3033
"github.com/prometheus/prometheus/model/rulefmt"
3134
)
3235

36+
var promtoolPath = os.Args[0]
37+
38+
func TestMain(m *testing.M) {
39+
for i, arg := range os.Args {
40+
if arg == "-test.main" {
41+
os.Args = append(os.Args[:i], os.Args[i+1:]...)
42+
main()
43+
return
44+
}
45+
}
46+
47+
exitCode := m.Run()
48+
os.Exit(exitCode)
49+
}
50+
3351
func TestQueryRange(t *testing.T) {
3452
s, getRequest := mockServer(200, `{"status": "success", "data": {"resultType": "matrix", "result": []}}`)
3553
defer s.Close()
@@ -359,3 +377,59 @@ func TestCheckMetricsExtended(t *testing.T) {
359377
},
360378
}, stats)
361379
}
380+
381+
func TestExitCodes(t *testing.T) {
382+
if testing.Short() {
383+
t.Skip("skipping test in short mode.")
384+
}
385+
386+
for _, c := range []struct {
387+
file string
388+
exitCode int
389+
lintIssue bool
390+
}{
391+
{
392+
file: "prometheus-config.good.yml",
393+
},
394+
{
395+
file: "prometheus-config.bad.yml",
396+
exitCode: 1,
397+
},
398+
{
399+
file: "prometheus-config.nonexistent.yml",
400+
exitCode: 1,
401+
},
402+
{
403+
file: "prometheus-config.lint.yml",
404+
lintIssue: true,
405+
exitCode: 3,
406+
},
407+
} {
408+
t.Run(c.file, func(t *testing.T) {
409+
for _, lintFatal := range []bool{true, false} {
410+
t.Run(fmt.Sprintf("%t", lintFatal), func(t *testing.T) {
411+
args := []string{"-test.main", "check", "config", "testdata/" + c.file}
412+
if lintFatal {
413+
args = append(args, "--lint-fatal")
414+
}
415+
tool := exec.Command(promtoolPath, args...)
416+
err := tool.Run()
417+
if c.exitCode == 0 || (c.lintIssue && !lintFatal) {
418+
require.NoError(t, err)
419+
return
420+
}
421+
422+
require.Error(t, err)
423+
424+
var exitError *exec.ExitError
425+
if errors.As(err, &exitError) {
426+
status := exitError.Sys().(syscall.WaitStatus)
427+
require.Equal(t, c.exitCode, status.ExitStatus())
428+
} else {
429+
t.Errorf("unable to retrieve the exit status for promtool: %v", err)
430+
}
431+
})
432+
}
433+
})
434+
}
435+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
not-prometheus:

0 commit comments

Comments
 (0)