@@ -3,12 +3,7 @@ name: CI
3
3
on :
4
4
push :
5
5
branches :
6
- - main
7
- tags :
8
- - " v[0-9]+.[0-9]+.[0-9]+"
9
- pull_request :
10
- branches :
11
- - main
6
+ - chore/test-quay
12
7
13
8
env :
14
9
DOCKER_PLATFORMS : " linux/arm/v5,linux/arm/v6,linux/arm/v7,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x,linux/mips64le,linux/386,linux/riscv64"
@@ -21,26 +16,6 @@ permissions:
21
16
contents : read
22
17
23
18
jobs :
24
- unit-tests :
25
- name : Unit Tests
26
- runs-on : ubuntu-24.04
27
- steps :
28
- - name : Checkout Repository
29
- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30
-
31
- - name : Setup Golang Environment
32
- uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
33
- with :
34
- go-version : stable
35
-
36
- - name : Run Tests
37
- run : make test
38
-
39
- - name : Upload coverage reports to Codecov
40
- uses : codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
41
- with :
42
- token : ${{ secrets.CODECOV_TOKEN }}
43
-
44
19
build-docker :
45
20
name : Build Docker Image
46
21
runs-on : ubuntu-24.04
50
25
id-token : write # for OIDC login to AWS ECR and goreleaser/goreleaser-action to sign artifacts
51
26
packages : write # for docker/build-push-action to push to GHCR
52
27
issues : write # for goreleaser/goreleaser-action to close milestones
53
- needs : unit-tests
54
28
services :
55
29
registry :
56
30
image : registry:3
@@ -67,156 +41,9 @@ jobs:
67
41
with :
68
42
go-version : stable
69
43
70
- - name : Setup QEMU
71
- uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
72
-
73
- - name : Docker Buildx
74
- uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
75
- with :
76
- version : latest
77
- driver-opts : network=host
78
-
79
- - name : DockerHub Login
80
- uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
81
- with :
82
- username : ${{ secrets.DOCKER_USERNAME }}
83
- password : ${{ secrets.DOCKER_PASSWORD }}
84
- if : github.event_name != 'pull_request'
85
-
86
- - name : Login to GitHub Container Registry
87
- uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
88
- with :
89
- registry : ghcr.io
90
- username : ${{ github.repository_owner }}
91
- password : ${{ secrets.GITHUB_TOKEN }}
92
- if : github.event_name != 'pull_request'
93
-
94
- - name : Configure AWS Credentials
95
- uses : aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
96
- with :
97
- aws-region : us-east-1
98
- role-to-assume : ${{ secrets.AWS_ROLE_PUBLIC_ECR }}
99
- if : github.event_name != 'pull_request'
100
-
101
- - name : Login to Public ECR
102
- uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
103
- with :
104
- registry : public.ecr.aws
105
- if : github.event_name != 'pull_request'
106
-
107
44
- name : Login to Quay.io
108
45
uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
109
46
with :
110
47
registry : quay.io
111
48
username : ${{ secrets.QUAY_USERNAME }}
112
49
password : ${{ secrets.QUAY_ROBOT_TOKEN }}
113
- if : github.event_name != 'pull_request'
114
-
115
- - name : Docker meta
116
- id : meta
117
- uses : docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
118
- with :
119
- images : |
120
- name=nginx/nginx-prometheus-exporter,enable=${{ github.event_name != 'pull_request' }}
121
- name=ghcr.io/nginx/nginx-prometheus-exporter,enable=${{ github.event_name != 'pull_request' }}
122
- name=public.ecr.aws/nginx/nginx-prometheus-exporter,enable=${{ github.event_name != 'pull_request' }}
123
- name=quay.io/nginx/nginx-prometheus-exporter,enable=${{ github.event_name != 'pull_request' }}
124
- name=localhost:5000/nginx/nginx-prometheus-exporter
125
- tags : |
126
- type=edge
127
- type=ref,event=pr
128
- type=schedule
129
- type=semver,pattern={{version}}
130
- type=semver,pattern={{major}}
131
- type=semver,pattern={{major}}.{{minor}}
132
- labels : |
133
- org.opencontainers.image.vendor=NGINX Inc <[email protected] >
134
- env :
135
- DOCKER_METADATA_ANNOTATIONS_LEVELS : manifest,index
136
-
137
- - name : Create/Update Draft
138
- uses : lucacome/draft-release@00f74370c044c322da6cb52acc707d62c7762c71 # v1.2.4
139
- with :
140
- minor-label : " enhancement"
141
- major-label : " change"
142
- publish : ${{ github.ref_type == 'tag' }}
143
- collapse-after : 30
144
- notes-footer : |
145
- ## Upgrade
146
-
147
- - Use the {{version}} image from our [DockerHub](https://hub.docker.com/r/nginx/nginx-prometheus-exporter/tags?page=1&ordering=last_updated&name={{version-number}}), [GitHub Container](https://github.com/nginx/nginx-prometheus-exporter/pkgs/container/nginx-prometheus-exporter), [Amazon ECR Public Gallery](https://gallery.ecr.aws/nginx/nginx-prometheus-exporter) or [Quay.io](https://quay.io/repository/nginx/nginx-prometheus-exporter/tag/{{version-number}}?tab=tags).
148
- - Download the latest binaries from the [GitHub releases page](https://github.com/nginx/nginx-prometheus-exporter/releases/tag/{{version}}).
149
- - Update to the latest version with `brew upgrade nginx-prometheus-exporter`, `snap refresh nginx-prometheus-exporter` or `scoop update nginx-prometheus-exporter`.
150
-
151
- ## Compatibility
152
-
153
- - NGINX 0.1.18 or newer.
154
- - NGINX Plus R19 or newer.
155
- if : github.event_name != 'pull_request'
156
-
157
- - name : Download Syft
158
- uses : anchore/sbom-action/download-syft@da167eac915b4e86f08b264dbdbc867b61be6f0c # v0.20.5
159
- if : github.ref_type == 'tag'
160
-
161
- - name : Install Cosign
162
- uses : sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
163
- if : github.ref_type == 'tag'
164
-
165
- - name : Setup Snapcraft
166
- run : |
167
- sudo snap install snapcraft --classic
168
- mkdir -p $HOME/.cache/snapcraft/download
169
- mkdir -p $HOME/.cache/snapcraft/stage-packages
170
- if : github.ref_type == 'tag'
171
-
172
- - name : Install Nix
173
- uses : cachix/install-nix-action@c134e4c9e34bac6cab09cf239815f9339aaaf84e # v31
174
- with :
175
- github_access_token : ${{ secrets.GITHUB_TOKEN }}
176
- if : github.ref_type == 'tag'
177
-
178
- - name : Run GoReleaser
179
- uses : goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
180
- with :
181
- version : v2.11.2 # renovate: datasource=github-tags depName=goreleaser/goreleaser
182
- args : ${{ github.ref_type == 'tag' && 'release' || 'build --snapshot' }} --clean
183
- env :
184
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
185
- NGINX_GITHUB_TOKEN : ${{ secrets.NGINX_PAT }}
186
- SNAPCRAFT_STORE_CREDENTIALS : ${{ secrets.SNAPCRAFT_LOGIN }}
187
-
188
- - name : Print NGINX Prometheus Exporter info
189
- run : ./dist/nginx-prometheus-exporter_linux_amd64_v1/nginx-prometheus-exporter --version
190
- continue-on-error : true
191
-
192
- - name : Build and Push Docker Image
193
- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
194
- with :
195
- file : build/Dockerfile
196
- context : " ."
197
- target : goreleaser
198
- platforms : ${{ env.DOCKER_PLATFORMS }}
199
- tags : ${{ steps.meta.outputs.tags }}
200
- labels : ${{ steps.meta.outputs.labels }}
201
- annotations : ${{ steps.meta.outputs.annotations }}
202
- push : true
203
- cache-from : type=gha,scope=exporter
204
- cache-to : type=gha,scope=exporter,mode=max
205
- no-cache : ${{ github.event_name != 'pull_request' }}
206
- provenance : mode=max
207
- sbom : true
208
-
209
- - name : Scan image
210
- uses : anchore/scan-action@1638637db639e0ade3258b51db49a9a137574c3e # v6.5.1
211
- id : scan
212
- continue-on-error : true
213
- with :
214
- image : localhost:5000/nginx/nginx-prometheus-exporter:${{ steps.meta.outputs.version }}
215
- only-fixed : true
216
- add-cpes-if-none : true
217
-
218
- - name : Upload scan result to GitHub Security tab
219
- uses : github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
220
- continue-on-error : true
221
- with :
222
- sarif_file : ${{ steps.scan.outputs.sarif }}
0 commit comments