Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: bump to Go 1.17 #2792

Merged
merged 2 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 123 additions & 131 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,155 +1,147 @@
---
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
# containers with mounted volumes which isn't supported with the docker
# executor (even with setup_remote_docker).
machine: true
steps:
- checkout
- run: sudo service docker restart
- run:
name: Remove existing Go installation
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"
- run:
name: Remove generated code
command: make clean
- run:
name: Generate front-end code
command: make all
working_directory: ~/project/ui/app
environment:
JUNIT_DIR: ~/test-results
- run:
name: Generate assets
command: make assets
- run:
name: Generate API v2 code
command: make apiv2
- run: git diff --exit-code
- store_test_results:
path: ~/test-results

- checkout
- run: sudo service docker restart
- run:
name: Remove existing Go installation
command: sudo rm -rf /usr/local/go
# Whenever the Go version is updated here, .promu.yml should also be updated.
- go/install:
version: "1.17"
- run:
name: Remove generated code
command: make clean
- run:
name: Generate front-end code
command: make all
working_directory: ~/project/ui/app
environment:
JUNIT_DIR: ~/test-results
- run:
name: Generate assets
command: make assets
- run:
name: Generate API v2 code
command: make apiv2
- 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
# 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
name: maildev-noauth
entrypoint: bin/maildev
command:
- -v
- image: djfarrelly/maildev:1.1.0
name: maildev-auth
entrypoint: bin/maildev
command:
- -v
- --incoming-user
- user
- --incoming-pass
- pass

# Whenever the Go version is updated here, .promu.yml should also be updated.
- 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
name: maildev-noauth
entrypoint: bin/maildev
command:
- -v
- image: djfarrelly/maildev:1.1.0
name: maildev-auth
entrypoint: bin/maildev
command:
- -v
- --incoming-user
- 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:
key: v1-go-mod
- run:
command: |
cat \<<EOF > $EMAIL_NO_AUTH_CONFIG
smarthost: maildev-noauth:1025
server: http://maildev-noauth:1080/
EOF
cat \<<EOF > $EMAIL_AUTH_CONFIG
smarthost: maildev-auth:1025
server: http://maildev-auth:1080/
username: user
password: pass
EOF
- run:
command: make
environment:
# By default Go uses GOMAXPROCS but a Circle CI executor has many
# cores (> 30) while the CPU and RAM resources are throttled. If we
# don't limit this to the number of allocated cores, the job is
# likely to get OOMed and killed.
GOOPTS: "-p 2"
- prometheus/check_proto:
version: "3.15.8"
- prometheus/store_artifact:
file: alertmanager
- prometheus/store_artifact:
file: amtool
- go/save-cache:
key: v1-go-mod
- store_test_results:
path: test-results

- prometheus/setup_environment
- go/load-cache:
key: v1-go-mod
- run:
command: |
cat \<<EOF > $EMAIL_NO_AUTH_CONFIG
smarthost: maildev-noauth:1025
server: http://maildev-noauth:1080/
EOF
cat \<<EOF > $EMAIL_AUTH_CONFIG
smarthost: maildev-auth:1025
server: http://maildev-auth:1080/
username: user
password: pass
EOF
- run:
command: make
environment:
# By default Go uses GOMAXPROCS but a Circle CI executor has many
# cores (> 30) while the CPU and RAM resources are throttled. If we
# don't limit this to the number of allocated cores, the job is
# likely to get OOMed and killed.
GOOPTS: "-p 2"
- prometheus/check_proto:
version: "3.15.8"
- prometheus/store_artifact:
file: alertmanager
- prometheus/store_artifact:
file: amtool
- go/save-cache:
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

# Whenever the Go version is updated here, .promu.yml should also be updated.
- 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

- 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:
jobs:
- test_frontend:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- prometheus/build:
name: build
parallelism: 8
filters:
tags:
only: /.*/
- mixin:
filters:
tags:
only: /.*/
- prometheus/publish_main:
context: org-context
requires:
- test_frontend
- test
- build
filters:
branches:
only: main
- prometheus/publish_release:
context: org-context
requires:
- test_frontend
- test
- build
filters:
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: /.*/
- test_frontend:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- prometheus/build:
name: build
parallelism: 8
filters:
tags:
only: /.*/
- mixin:
filters:
tags:
only: /.*/
- prometheus/publish_main:
context: org-context
requires:
- test_frontend
- test
- build
filters:
branches:
only: main
- prometheus/publish_release:
context: org-context
requires:
- test_frontend
- test
- build
filters:
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: /.*/
8 changes: 3 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
run:
deadline: 5m

issues:
exclude-rules:
- path: _test.go
linters:
- errcheck

- path: _test.go
linters:
- errcheck
linters-settings:
errcheck:
exclude: scripts/errcheck_excludes.txt
2 changes: 1 addition & 1 deletion .promu.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
17 changes: 17 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions asset/asset_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions asset/assets_vfsdata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/testdata/conf.bad.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BAD
BAD
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
20 changes: 7 additions & 13 deletions config/testdata/conf.empty-fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

- match_re:
service: ^(foo1|foo2|baz)$
receiver: team-X-mails
receivers:
- name: 'team-X-mails'
email_configs:
- to: 'team-X+alerts@example.org'
- name: 'team-X-mails'
email_configs:
- to: 'team-X+alerts@example.org'
Loading