*: bump to Go 1.17 (#2792)

* *: bump to Go 1.17

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* *: fix yamllint errors

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2021-12-22 14:03:53 +01:00 committed by GitHub
parent dcaa3a05be
commit 48a99764a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 410 additions and 451 deletions

View File

@ -1,10 +1,8 @@
---
version: 2.1
orbs:
prometheus: prometheus/prometheus@0.11.0
go: circleci/go@0.2.0
go: circleci/go@1.7.0
jobs:
test_frontend:
# We need to use a machine executor because the front-end validation runs
@ -19,7 +17,7 @@ jobs:
command: sudo rm -rf /usr/local/go
# Whenever the Go version is updated here, .promu.yml should also be updated.
- go/install:
version: "1.16"
version: "1.17"
- run:
name: Remove generated code
command: make clean
@ -38,11 +36,10 @@ jobs:
- run: git diff --exit-code
- store_test_results:
path: ~/test-results
test:
docker:
# Whenever the Go version is updated here, .promu.yml should also be updated.
- image: circleci/golang:1.16
- image: quay.io/prometheus/golang-builder:1.17-base
# maildev containers are for running the email tests against a "real" SMTP server.
# See notify/email_test.go for details.
- image: djfarrelly/maildev:1.1.0
@ -59,11 +56,9 @@ jobs:
- user
- --incoming-pass
- pass
environment:
EMAIL_NO_AUTH_CONFIG: /tmp/smtp_no_auth.yml
EMAIL_AUTH_CONFIG: /tmp/smtp_auth.yml
steps:
- prometheus/setup_environment
- go/load-cache:
@ -98,19 +93,16 @@ jobs:
key: v1-go-mod
- store_test_results:
path: test-results
mixin:
docker:
# Whenever the Go version is updated here, .promu.yml should also be updated.
- image: circleci/golang:1.16
- image: quay.io/prometheus/golang-builder:1.17-base
steps:
- checkout
- run: cd doc/alertmanager-mixin; go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest
- run: cd doc/alertmanager-mixin; go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
- run: cd doc/alertmanager-mixin; go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
- run: cd doc/alertmanager-mixin; make lint
workflows:
version: 2
alertmanager:

View File

@ -1,13 +1,11 @@
---
run:
deadline: 5m
issues:
exclude-rules:
- path: _test.go
linters:
- errcheck
linters-settings:
errcheck:
exclude: scripts/errcheck_excludes.txt

View File

@ -1,7 +1,7 @@
go:
# Whenever the Go version is updated here, .travis.yml and
# .circle/config.yml should also be updated.
version: 1.16
version: 1.17
repository:
path: github.com/prometheus/alertmanager
build:

17
.yamllint Normal file
View File

@ -0,0 +1,17 @@
---
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
commas: disable
comments: disable
comments-indentation: disable
document-start: disable
indentation:
spaces: consistent
line-length: disable

View File

@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build dev
// +build dev
package asset

View File

@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build ignore
// +build ignore
package main

View File

@ -1,5 +1,6 @@
// Code generated by vfsgen; DO NOT EDIT.
//go:build !dev
// +build !dev
package asset

View File

@ -1015,7 +1015,7 @@ func TestOpsGenieDeprecatedTeamSpecified(t *testing.T) {
}
const expectedErr = `yaml: unmarshal errors:
line 18: field teams not found in type config.plain`
line 16: field teams not found in type config.plain`
if err.Error() != expectedErr {
t.Errorf("Expected: %s\nGot: %s", expectedErr, err.Error())
}

View File

@ -5,21 +5,15 @@ global:
smtp_auth_password: ''
smtp_hello: ''
slack_api_url: 'https://slack.com/webhook'
templates:
- '/etc/alertmanager/template/*.tmpl'
route:
group_by: ['alertname', 'cluster', 'service']
receiver: team-X-mails
routes:
- match_re:
service: ^(foo1|foo2|baz)$
receiver: team-X-mails
receivers:
- name: 'team-X-mails'
email_configs:

View File

@ -8,38 +8,29 @@ global:
slack_api_url: "http://mysecret.example.com/"
http_config:
proxy_url: 'http://127.0.0.1:1025'
# The directory from which notification templates are read.
templates:
- '/etc/alertmanager/template/*.tmpl'
# The root route on which each incoming alert enters.
route:
# The labels by which incoming alerts are grouped together. For example,
# multiple alerts coming in for cluster=A and alertname=LatencyHigh would
# be batched into a single group.
group_by: ['alertname', 'cluster', 'service']
# When a new group of alerts is created by an incoming alert, wait at
# least 'group_wait' to send the initial notification.
# This way ensures that you get multiple alerts for the same group that start
# firing shortly after another are batched together on the first
# notification.
group_wait: 30s
# When the first notification was sent, wait 'group_interval' to send a batch
# of new alerts that started firing for that group.
group_interval: 5m
# If an alert has successfully been sent, wait 'repeat_interval' to
# resend them.
repeat_interval: 3h
# A default receiver
receiver: team-X-mails
# All the above attributes are inherited by all child routes and can
# overwritten on each.
@ -60,12 +51,10 @@ route:
- match:
service: files
receiver: team-Y-mails
routes:
- match:
severity: critical
receiver: team-Y-pager
# This route handles all alerts coming from a database service. If there's
# no team to handle it, it defaults to the DB team.
- match:
@ -82,8 +71,6 @@ route:
owner: team-Y
receiver: team-Y-pager
# continue: true
# Inhibition rules allow to mute a set of alerts given that another alert is
# firing.
# We use this to mute any warning-level notifications if the same alert is
@ -95,27 +82,21 @@ inhibit_rules:
severity: 'warning'
# Apply inhibition if the alertname is the same.
equal: ['alertname', 'cluster', 'service']
receivers:
- name: 'team-X-mails'
email_configs:
- to: 'team-X+alerts@example.org'
- name: 'team-X-pager'
email_configs:
- to: 'team-X+alerts-critical@example.org'
pagerduty_configs:
- routing_key: "mysecret"
- name: 'team-Y-mails'
email_configs:
- to: 'team-Y+alerts@example.org'
- name: 'team-Y-pager'
pagerduty_configs:
- routing_key: "mysecret"
- name: 'team-DB-pager'
pagerduty_configs:
- routing_key: "mysecret"

View File

@ -1,10 +1,8 @@
route:
group_by: [...]
group_by: ['...']
group_wait: 30s
group_interval: 5m
repeat_interval: 3h
receiver: team-X
receivers:
- name: 'team-X'

View File

@ -1,10 +1,8 @@
route:
receiver: empty
routes:
- match_re:
invalid_label:
receiver: empty
receivers:
- name: empty

View File

@ -1,9 +1,7 @@
route:
receiver: empty
receivers:
- name: empty
inhibit_rules:
- source_match_re:
invalid_source_label:

View File

@ -1,9 +1,7 @@
route:
receiver: empty
receivers:
- name: empty
inhibit_rules:
- source_match:
severity: critical

View File

@ -1,7 +1,6 @@
global:
opsgenie_api_key: asd132
opsgenie_api_key_file: '/global_file'
route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 30s
@ -12,7 +11,6 @@ route:
- match:
service: foo
receiver: team-X-opsgenie
receivers:
- name: 'team-X-opsgenie'
opsgenie_configs:

View File

@ -1,6 +1,5 @@
global:
opsgenie_api_key_file: '/global_file'
route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 30s
@ -11,7 +10,6 @@ route:
- match:
service: foo
receiver: team-X-opsgenie
receivers:
- name: 'team-X-opsgenie'
opsgenie_configs:

View File

@ -1,6 +1,5 @@
global:
opsgenie_api_key: asd132
route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 30s
@ -11,7 +10,6 @@ route:
- match:
service: foo
receiver: team-X-opsgenie
receivers:
- name: 'team-X-opsgenie'
opsgenie_configs:

View File

@ -1,6 +1,5 @@
global:
opsgenie_api_key: asd132
route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 30s
@ -11,7 +10,6 @@ route:
- match:
service: foo
receiver: team-X-opsgenie
receivers:
- name: 'team-X-opsgenie'
opsgenie_configs:

View File

@ -8,7 +8,6 @@ route:
- match:
service: foo
receiver: team-X-opsgenie
receivers:
- name: 'team-X-opsgenie'
opsgenie_configs:

View File

@ -1,11 +1,9 @@
global:
slack_api_url: "http://mysecret.example.com/"
slack_api_url_file: '/global_file'
route:
receiver: 'slack-notifications'
group_by: [alertname, datacenter, app]
receivers:
- name: 'slack-notifications'
slack_configs:

View File

@ -1,10 +1,8 @@
global:
slack_api_url_file: '/global_file'
route:
receiver: 'slack-notifications'
group_by: [alertname, datacenter, app]
receivers:
- name: 'slack-notifications'
slack_configs:

View File

@ -1,7 +1,6 @@
route:
receiver: 'slack-notifications'
group_by: [alertname, datacenter, app]
receivers:
- name: 'slack-notifications'
slack_configs:

View File

@ -1,7 +1,6 @@
route:
receiver: 'sns-api-notifications'
group_by: [alertname]
receivers:
- name: 'sns-api-notifications'
sns_configs:

View File

@ -1,7 +1,6 @@
route:
receiver: 'sns-api-notifications'
group_by: [alertname]
receivers:
- name: 'sns-api-notifications'
sns_configs:

View File

@ -1,6 +1,5 @@
global:
victorops_api_key: asd132
route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 30s
@ -11,7 +10,6 @@ route:
- match:
service: foo
receiver: team-X-victorops
receivers:
- name: 'team-X-victorops'
victorops_configs:

View File

@ -8,7 +8,6 @@ route:
- match:
service: foo
receiver: team-X-victorops
receivers:
- name: 'team-X-victorops'
victorops_configs:

View File

@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build tools
// +build tools
// Package tools tracks dependencies for tools that are required to generate the protobuf code.