Skip to content

Commit e8f0c58

Browse files
author
Kate Osborn
committed
Workflow changes
1 parent 48e8912 commit e8f0c58

File tree

2 files changed

+23
-30
lines changed

2 files changed

+23
-30
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ jobs:
202202
context: "."
203203
target: goreleaser
204204
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
207207
pull: true
208208

209209
- name: Build NGINX Docker Image
@@ -213,8 +213,8 @@ jobs:
213213
tags: ${{ steps.nginx-meta.outputs.tags }}
214214
context: "."
215215
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
218218
pull: true
219219
build-args: |
220220
NJS_DIR=internal/mode/static/nginx/modules/src
@@ -254,17 +254,7 @@ jobs:
254254
strategy:
255255
fail-fast: false
256256
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]
268258
permissions:
269259
contents: read # for docker/build-push-action to read repo content
270260
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
@@ -300,7 +290,7 @@ jobs:
300290
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
301291
with:
302292
images: |
303-
name=${{ matrix.image }}
293+
name=ghcr.io/nginxinc/nginx-kubernetes-gateway${{ matrix.container == 'nginx' && '/nginx' || '' }}
304294
tags: |
305295
type=semver,pattern={{version}}
306296
type=edge
@@ -310,43 +300,46 @@ jobs:
310300
- name: Build Docker Image
311301
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
312302
with:
313-
file: ${{ matrix.dockerfile }}
303+
file: ${{ matrix.container == 'nginx' && 'build/dockerfile.nginx' || 'build.dockerfile' }}
314304
context: "."
315-
target: ${{ matrix.target }}
305+
target: ${{ matrix.container == 'nkg' && 'goreleaser' || '' }}
316306
tags: ${{ steps.meta.outputs.tags }}
317307
labels: ${{ steps.meta.outputs.labels }}
318308
load: ${{ github.event_name == 'pull_request' }}
319309
push: ${{ github.event_name != 'pull_request' }}
320310
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
323313
pull: true
324314
no-cache: ${{ github.event_name != 'pull_request' }}
325315
sbom: ${{ github.event_name != 'pull_request' }}
326316
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+
328321
329322
- name: Run Trivy vulnerability scanner
330323
uses: aquasecurity/trivy-action@41f05d9ecffa2ed3f1580af306000f734b733e54 # 0.11.2
331324
continue-on-error: true
332325
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 }}
334327
format: "sarif"
335-
output: ${{ matrix.sarif-file }}
328+
output: trivy-results-nginx-kubernetes-gateway{{$ matrix.container == 'nginx' && '-nginx' || '' }}.sarif
336329
ignore-unfixed: "true"
337330

338331
- name: Upload Trivy scan results to GitHub Security tab
339332
uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
340333
continue-on-error: true
341334
with:
342-
sarif_file: ${{ matrix.sarif-file }}
335+
sarif_file: trivy-results-nginx-kubernetes-gateway{{$ matrix.container == 'nginx' && '-nginx' || '' }}.sarif
343336

344337
- name: Upload Scan Results
345338
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
346339
continue-on-error: true
347340
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
350343
if: always()
351344

352345
publish-helm:

.github/workflows/conformance.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ jobs:
8787
context: "."
8888
target: goreleaser
8989
load: true
90-
cache-from: type=gha
91-
cache-to: type=gha,mode=max
90+
cache-from: type=gha,scope=nkg
91+
cache-to: type=gha,scope=nkg,mode=max
9292
pull: true
9393

9494
- name: Build NGINX Docker Image
@@ -98,8 +98,8 @@ jobs:
9898
tags: ${{ steps.nginx-meta.outputs.tags }}
9999
context: "."
100100
load: true
101-
cache-from: type=gha
102-
cache-to: type=gha,mode=max
101+
cache-from: type=gha,scope=nginx
102+
cache-to: type=gha,scope=nginx,mode=max
103103
pull: true
104104
build-args: |
105105
NJS_DIR=internal/mode/static/nginx/modules/src

0 commit comments

Comments
 (0)