*: 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,22 +5,16 @@ global:
smtp_auth_password: ''
smtp_hello: ''
slack_api_url: 'https://slack.com/webhook'
templates:
- '/etc/alertmanager/template/*.tmpl'
- '/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'
- name: 'team-X-mails'
email_configs:
- to: 'team-X+alerts@example.org'

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'
- '/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,55 +71,47 @@ 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
# already critical.
inhibit_rules:
- source_match:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
# Apply inhibition if the alertname is the same.
equal: ['alertname', 'cluster', 'service']
receivers:
- name: 'team-X-mails'
- name: 'team-X-mails'
email_configs:
- to: 'team-X+alerts@example.org'
- name: 'team-X-pager'
- name: 'team-X-pager'
email_configs:
- to: 'team-X+alerts-critical@example.org'
pagerduty_configs:
- routing_key: "mysecret"
- name: 'team-Y-mails'
- name: 'team-Y-mails'
email_configs:
- to: 'team-Y+alerts@example.org'
- name: 'team-Y-pager'
- name: 'team-Y-pager'
pagerduty_configs:
- routing_key: "mysecret"
- name: 'team-DB-pager'
- name: 'team-DB-pager'
pagerduty_configs:
- routing_key: "mysecret"
- name: victorOps-receiver
- name: victorOps-receiver
victorops_configs:
- api_key: mysecret
routing_key: Sample_route
- name: opsGenie-receiver
- name: opsGenie-receiver
opsgenie_configs:
- api_key: mysecret
- name: pushover-receiver
- name: pushover-receiver
pushover_configs:
- token: mysecret
user_key: key
- name: slack-receiver
- name: slack-receiver
slack_configs:
- channel: '#my-channel'
image_url: 'http://some.img.com/img.png'

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'
- name: 'team-X'

View File

@ -5,7 +5,7 @@ global:
route:
receiver: team-X-slack
receivers:
- name: 'team-X-slack'
- name: 'team-X-slack'
slack_configs:
- http_config:
proxy_url: foo

View File

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

View File

@ -1,11 +1,9 @@
route:
receiver: empty
receivers:
- name: empty
- name: empty
inhibit_rules:
- source_match_re:
- source_match_re:
invalid_source_label:
target_match_re:
severity: critical

View File

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

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,14 +11,13 @@ route:
- match:
service: foo
receiver: team-X-opsgenie
receivers:
- name: 'team-X-opsgenie'
- name: 'team-X-opsgenie'
opsgenie_configs:
- responders:
- name: 'team-X'
type: 'team'
- name: 'escalation-Y-opsgenie'
- name: 'escalation-Y-opsgenie'
opsgenie_configs:
- responders:
- name: 'escalation-Y'

View File

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

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,14 +10,13 @@ route:
- match:
service: foo
receiver: team-X-opsgenie
receivers:
- name: 'team-X-opsgenie'
- name: 'team-X-opsgenie'
opsgenie_configs:
- responders:
- name: 'team-X'
type: 'team'
- name: 'escalation-Y-opsgenie'
- name: 'escalation-Y-opsgenie'
opsgenie_configs:
- responders:
- name: 'escalation-Y'

View File

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

View File

@ -1,13 +1,11 @@
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'
- name: 'slack-notifications'
slack_configs:
- channel: '#alerts1'
text: 'test'

View File

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

View File

@ -1,9 +1,8 @@
route:
receiver: 'slack-notifications'
group_by: [alertname, datacenter, app]
receivers:
- name: 'slack-notifications'
- name: 'slack-notifications'
slack_configs:
- channel: '#alerts'
text: 'test'

View File

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

View File

@ -1,9 +1,8 @@
route:
receiver: 'sns-api-notifications'
group_by: [alertname]
receivers:
- name: 'sns-api-notifications'
- name: 'sns-api-notifications'
sns_configs:
- api_url: https://sns.us-east-2.amazonaws.com
topic_arn: arn:aws:sns:us-east-2:123456789012:My-Topic

View File

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

View File

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

View File

@ -7,7 +7,7 @@ global:
# The directory from which notification templates are read.
templates:
- '/etc/alertmanager/template/*.tmpl'
- '/etc/alertmanager/template/*.tmpl'
# The root route on which each incoming alert enters.
route:
@ -88,35 +88,35 @@ route:
# We use this to mute any warning-level notifications if the same alert is
# already critical.
inhibit_rules:
- source_matchers: [ severity="critical" ]
target_matchers: [ severity="warning" ]
- source_matchers: [severity="critical"]
target_matchers: [severity="warning"]
# Apply inhibition if the alertname is the same.
# CAUTION:
# If all label names listed in `equal` are missing
# from both the source and target alerts,
# the inhibition rule will apply!
equal: [ alertname, cluster, service ]
equal: [alertname, cluster, service]
receivers:
- name: 'team-X-mails'
- name: 'team-X-mails'
email_configs:
- to: 'team-X+alerts@example.org'
- name: 'team-X-pager'
- name: 'team-X-pager'
email_configs:
- to: 'team-X+alerts-critical@example.org'
pagerduty_configs:
- service_key: <team-X-key>
- name: 'team-Y-mails'
- name: 'team-Y-mails'
email_configs:
- to: 'team-Y+alerts@example.org'
- name: 'team-Y-pager'
- name: 'team-Y-pager'
pagerduty_configs:
- service_key: <team-Y-key>
- name: 'team-DB-pager'
- name: 'team-DB-pager'
pagerduty_configs:
- service_key: <team-DB-key>

View File

@ -5,7 +5,7 @@ route:
repeat_interval: 1h
receiver: 'web.hook'
receivers:
- name: 'web.hook'
- name: 'web.hook'
webhook_configs:
- url: 'http://127.0.0.1:5001/'
inhibit_rules:

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.