@@ -202,8 +202,8 @@ jobs:
202
202
context : " ."
203
203
target : goreleaser
204
204
load : true
205
- cache-from : type=gha
206
- cache-to : type=gha,mode=max
205
+ cache-from : type=gha,scope=nkg
206
+ cache-to : type=gha,scope=nkg, mode=max
207
207
pull : true
208
208
209
209
- name : Build NGINX Docker Image
@@ -213,8 +213,8 @@ jobs:
213
213
tags : ${{ steps.nginx-meta.outputs.tags }}
214
214
context : " ."
215
215
load : true
216
- cache-from : type=gha
217
- cache-to : type=gha,mode=max
216
+ cache-from : type=gha,scope=nginx
217
+ cache-to : type=gha,scope=nginx, mode=max
218
218
pull : true
219
219
build-args : |
220
220
NJS_DIR=internal/mode/static/nginx/modules/src
@@ -254,17 +254,7 @@ jobs:
254
254
strategy :
255
255
fail-fast : false
256
256
matrix :
257
- include :
258
- - dockerfile : build/Dockerfile
259
- image : ghcr.io/nginxinc/nginx-kubernetes-gateway
260
- target : goreleaser
261
- sarif-file : trivy-results-nginx-kubernetes-gateway.sarif
262
- - dockerfile : build/Dockerfile.nginx
263
- image : ghcr.io/nginxinc/nginx-kubernetes-gateway/nginx
264
- sarif-file : trivy-results-nginx-kubernetes-gateway-nginx.sarif
265
- build-args : |
266
- NJS_DIR=internal/mode/static/nginx/modules/src
267
- NGINX_CONF_DIR=internal/mode/static/nginx/conf
257
+ container : [nkg, nginx]
268
258
permissions :
269
259
contents : read # for docker/build-push-action to read repo content
270
260
security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
@@ -300,7 +290,7 @@ jobs:
300
290
uses : docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
301
291
with :
302
292
images : |
303
- name=${{ matrix.image }}
293
+ name=ghcr.io/nginxinc/nginx-kubernetes-gateway ${{ matrix.container == 'nginx' && '/nginx' || '' }}
304
294
tags : |
305
295
type=semver,pattern={{version}}
306
296
type=edge
@@ -310,43 +300,46 @@ jobs:
310
300
- name : Build Docker Image
311
301
uses : docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
312
302
with :
313
- file : ${{ matrix.dockerfile }}
303
+ file : ${{ matrix.container == 'nginx' && 'build/ dockerfile.nginx' || 'build.dockerfile' }}
314
304
context : " ."
315
- target : ${{ matrix.target }}
305
+ target : ${{ matrix.container == 'nkg' && 'goreleaser' || '' }}
316
306
tags : ${{ steps.meta.outputs.tags }}
317
307
labels : ${{ steps.meta.outputs.labels }}
318
308
load : ${{ github.event_name == 'pull_request' }}
319
309
push : ${{ github.event_name != 'pull_request' }}
320
310
platforms : ${{ github.event_name != 'pull_request' && env.platforms || '' }}
321
- cache-from : type=gha
322
- cache-to : type=gha,mode=max
311
+ cache-from : type=gha,scope=${{ matrix.container }}
312
+ cache-to : type=gha,scope=${{ matrix.container }}, mode=max
323
313
pull : true
324
314
no-cache : ${{ github.event_name != 'pull_request' }}
325
315
sbom : ${{ github.event_name != 'pull_request' }}
326
316
provenance : false
327
- build-args : ${{ matrix.build-args }}
317
+ build-args : |
318
+ NJS_DIR=internal/mode/static/nginx/modules/src
319
+ NGINX_CONF_DIR=internal/mode/static/nginx/conf
320
+
328
321
329
322
- name : Run Trivy vulnerability scanner
330
323
uses : aquasecurity/trivy-action@41f05d9ecffa2ed3f1580af306000f734b733e54 # 0.11.2
331
324
continue-on-error : true
332
325
with :
333
- image-ref : ${{ matrix.image }}:${{ steps.meta.outputs.version }}
326
+ image-ref : ghcr.io/nginxinc/nginx-kubernetes-gateway ${{ matrix.container == 'nginx' && '/nginx' || '' }}:${{ steps.meta.outputs.version }}
334
327
format : " sarif"
335
- output : ${{ matrix.sarif-file }}
328
+ output : trivy-results-nginx-kubernetes-gateway{{$ matrix.container == 'nginx' && '-nginx' || '' }}.sarif
336
329
ignore-unfixed : " true"
337
330
338
331
- name : Upload Trivy scan results to GitHub Security tab
339
332
uses : github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
340
333
continue-on-error : true
341
334
with :
342
- sarif_file : ${{ matrix.sarif-file }}
335
+ sarif_file : trivy-results-nginx-kubernetes-gateway{{$ matrix.container == 'nginx' && '-nginx' || '' }}.sarif
343
336
344
337
- name : Upload Scan Results
345
338
uses : actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
346
339
continue-on-error : true
347
340
with :
348
- name : ${{ matrix.sarif-file }}
349
- path : ${{ matrix.sarif-file }}
341
+ name : trivy-results-nginx-kubernetes-gateway{{$ matrix.container == 'nginx' && '-nginx' || '' }}.sarif
342
+ path : trivy-results-nginx-kubernetes-gateway{{$ matrix.container == 'nginx' && '-nginx' || '' }}.sarif
350
343
if : always()
351
344
352
345
publish-helm :
0 commit comments