Skip to content

Commit b4a6a0b

Browse files
committed
Build WAF image in pipeline
1 parent d3c3c8d commit b4a6a0b

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ jobs:
8787
token_format: access_token
8888
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY }}
8989
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
90-
if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}
90+
if: ${{ github.event_name != 'pull_request' && (contains(inputs.image, 'plus') || inputs.image == 'plus-waf') }}
9191

9292
- name: Login to GAR
9393
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
9494
with:
9595
registry: us-docker.pkg.dev
9696
username: oauth2accesstoken
9797
password: ${{ steps.auth.outputs.access_token }}
98-
if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}
98+
if: ${{ github.event_name != 'pull_request' && (contains(inputs.image, 'plus') || inputs.image == 'plus-waf') }}
9999

100100
- name: Docker meta
101101
id: meta
@@ -106,7 +106,9 @@ jobs:
106106
name=ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric,enable=${{ inputs.image == 'ngf' && github.event_name != 'pull_request' }}
107107
name=ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric/nginx,enable=${{ inputs.image == 'nginx' && github.event_name != 'pull_request' }}
108108
name=docker-mgmt.nginx.com/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'plus' && github.event_name != 'pull_request' }}
109+
name=docker-mgmt.nginx.com/nginx-gateway-fabric/nginx-plus-nap-waf,enable=${{ inputs.image == 'plus-waf' && github.event_name != 'pull_request' }}
109110
name=us-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'plus' && github.event_name != 'pull_request' }}
111+
name=us-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/nginx-gateway-fabric/nginx-plus-nap-waf,enable=${{ inputs.image == 'plus-waf' && github.event_name != 'pull_request' }}
110112
name=localhost:5000/nginx-gateway-fabric/${{ inputs.image }}
111113
flavor: |
112114
latest=${{ (inputs.tag != '' && 'true') || 'auto' }}
@@ -134,7 +136,7 @@ jobs:
134136
- name: Build Docker Image
135137
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
136138
with:
137-
file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ inputs.image == 'plus' && '.nginxplus' || '' }}
139+
file: build/Dockerfile${{ inputs.image == 'nginx' && '.nginx' || '' }}${{ (inputs.image == 'plus' || inputs.image == 'plus-waf') && '.nginxplus' || '' }}
138140
context: "."
139141
target: ${{ inputs.image == 'ngf' && 'goreleaser' || '' }}
140142
tags: ${{ steps.meta.outputs.tags }}
@@ -146,17 +148,20 @@ jobs:
146148
cache-to: type=gha,scope=${{ inputs.image }},mode=max
147149
pull: true
148150
no-cache: ${{ github.event_name != 'pull_request' }}
149-
sbom: true
151+
sbom: ${{ inputs.image != 'plus-waf' }}
150152
provenance: mode=max
151153
build-args: |
152154
NJS_DIR=internal/controller/nginx/modules/src
153155
NGINX_CONF_DIR=internal/controller/nginx/conf
154156
BUILD_AGENT=gha
157+
${{ inputs.image == 'plus-waf' && 'ALPINE_VERSION=3.19' || '' }}
158+
${{ inputs.image == 'plus-waf' && 'INCLUDE_NAP_WAF=true' || '' }}
155159
secrets: |
156160
${{ contains(inputs.image, 'plus') && format('"nginx-repo.crt={0}"', secrets.NGINX_CRT) || '' }}
157161
${{ contains(inputs.image, 'plus') && format('"nginx-repo.key={0}"', secrets.NGINX_KEY) || '' }}
158162
159163
- name: Inspect SBOM and output manifest
164+
if: ${{ inputs.image != 'plus-waf' }}
160165
run: |
161166
docker buildx imagetools inspect localhost:5000/nginx-gateway-fabric/${{ inputs.image }}:${{ steps.meta.outputs.version }} --format '{{ json (index .SBOM "linux/amd64").SPDX }}' > sbom-${{ inputs.image }}.json
162167
docker buildx imagetools inspect localhost:5000/nginx-gateway-fabric/${{ inputs.image }}:${{ steps.meta.outputs.version }} --raw
@@ -169,11 +174,12 @@ jobs:
169174
only-fixed: true
170175
add-cpes-if-none: true
171176
fail-build: false
177+
if: inputs.image != 'plus-waf'
172178

173179
- name: Upload scan result to GitHub Security tab
174180
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
175181
continue-on-error: true
176182
with:
177183
sarif_file: ${{ steps.scan.outputs.sarif }}
178184
category: build-${{ inputs.image }}
179-
if: always()
185+
if: always() && inputs.image != 'plus-waf'

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,20 @@ jobs:
222222
id-token: write # for docker/login to login to NGINX registry
223223
secrets: inherit
224224

225+
build-plus-waf:
226+
name: Build Plus WAF images
227+
needs: [vars, binary]
228+
uses: ./.github/workflows/build.yml
229+
with:
230+
image: plus-waf
231+
platforms: "linux/amd64"
232+
permissions:
233+
contents: read # for docker/build-push-action to read repo content
234+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
235+
packages: write # for docker/build-push-action to push to GHCR
236+
id-token: write # for docker/login to login to NGINX registry
237+
secrets: inherit
238+
225239
functional-tests:
226240
name: Functional tests
227241
needs: [vars, build-oss, build-plus]

0 commit comments

Comments
 (0)