...
1---
2version: 2.1
3orbs:
4 prometheus: prometheus/prometheus@0.16.0
5 go: circleci/go@1.7.3
6jobs:
7 test_frontend:
8 # We need to use a machine executor because the front-end validation runs
9 # containers with mounted volumes which isn't supported with the docker
10 # executor (even with setup_remote_docker).
11 machine:
12 image: ubuntu-2204:current
13 steps:
14 - checkout
15 - run: sudo service docker restart
16 - run:
17 name: Remove existing Go installation
18 command: sudo rm -rf /usr/local/go
19 # Whenever the Go version is updated here, .promu.yml should also be updated.
20 - go/install:
21 version: "1.19"
22 - run:
23 name: Remove generated code
24 command: make clean
25 - run:
26 name: Generate front-end code
27 command: make all
28 working_directory: ~/project/ui/app
29 environment:
30 JUNIT_DIR: ~/test-results
31 - run:
32 name: Generate assets
33 command: make assets
34 - run:
35 name: Generate API v2 code
36 command: make apiv2
37 - run: git diff --exit-code
38 - store_test_results:
39 path: ~/test-results
40 - run:
41 name: Save assets
42 command: make assets-tarball
43 - persist_to_workspace:
44 root: .
45 paths:
46 - .tarballs
47 test:
48 docker:
49 # Whenever the Go version is updated here, .promu.yml should also be updated.
50 - image: quay.io/prometheus/golang-builder:1.19-base
51 # maildev containers are for running the email tests against a "real" SMTP server.
52 # See notify/email_test.go for details.
53 - image: maildev/maildev:1.1.0
54 name: maildev-noauth
55 entrypoint: bin/maildev
56 command:
57 - -v
58 - image: maildev/maildev:1.1.0
59 name: maildev-auth
60 entrypoint: bin/maildev
61 command:
62 - -v
63 - --incoming-user
64 - user
65 - --incoming-pass
66 - pass
67 environment:
68 EMAIL_NO_AUTH_CONFIG: /tmp/smtp_no_auth.yml
69 EMAIL_AUTH_CONFIG: /tmp/smtp_auth.yml
70 steps:
71 - prometheus/setup_environment
72 - go/load-cache:
73 key: v1-go-mod
74 - run:
75 command: |
76 cat \<<EOF > $EMAIL_NO_AUTH_CONFIG
77 smarthost: maildev-noauth:1025
78 server: http://maildev-noauth:1080/
79 EOF
80 cat \<<EOF > $EMAIL_AUTH_CONFIG
81 smarthost: maildev-auth:1025
82 server: http://maildev-auth:1080/
83 username: user
84 password: pass
85 EOF
86 - run:
87 command: make
88 environment:
89 # By default Go uses GOMAXPROCS but a Circle CI executor has many
90 # cores (> 30) while the CPU and RAM resources are throttled. If we
91 # don't limit this to the number of allocated cores, the job is
92 # likely to get OOMed and killed.
93 GOOPTS: "-p 2"
94 - prometheus/check_proto:
95 version: "3.15.8"
96 - prometheus/store_artifact:
97 file: alertmanager
98 - prometheus/store_artifact:
99 file: amtool
100 - go/save-cache:
101 key: v1-go-mod
102 - store_test_results:
103 path: test-results
104 mixin:
105 docker:
106 # Whenever the Go version is updated here, .promu.yml should also be updated.
107 - image: quay.io/prometheus/golang-builder:1.19-base
108 steps:
109 - checkout
110 - run: go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest
111 - run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
112 - run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
113 - run: make -C doc/alertmanager-mixin lint
114workflows:
115 version: 2
116 alertmanager:
117 jobs:
118 - test_frontend:
119 filters:
120 tags:
121 only: /.*/
122 - test:
123 filters:
124 tags:
125 only: /.*/
126 - prometheus/build:
127 name: build
128 parallelism: 3
129 promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
130 filters:
131 tags:
132 ignore: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/
133 branches:
134 ignore: /^(main|release-.*|.*build-all.*)$/
135 - prometheus/build:
136 name: build_all
137 parallelism: 12
138 filters:
139 branches:
140 only: /^(main|release-.*|.*build-all.*)$/
141 tags:
142 only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
143 - mixin:
144 filters:
145 tags:
146 only: /.*/
147 - prometheus/publish_main:
148 context: org-context
149 requires:
150 - test_frontend
151 - test
152 - build_all
153 docker_version: "20.10.18"
154 filters:
155 branches:
156 only: main
157 - prometheus/publish_release:
158 context: org-context
159 requires:
160 - test_frontend
161 # don't make the test job a requirement because it fails constantly
162 # on release-0.25.
163 #- test
164 - build_all
165 docker_version: "20.10.18"
166 filters:
167 tags:
168 only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
169 branches:
170 ignore: /.*/
View as plain text