56
56
image_matrix_oss : ${{ steps.vars.outputs.image_matrix_oss }}
57
57
image_matrix_plus : ${{ steps.vars.outputs.image_matrix_plus }}
58
58
image_matrix_nap : ${{ steps.vars.outputs.image_matrix_nap }}
59
+ docker_build : ${{ steps.docker_build.outputs.docker_build }}
59
60
steps :
60
61
- name : Checkout Repository
61
62
uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
83
84
with :
84
85
go-version-file : go.mod
85
86
86
- - name : Output Variables
87
+ - name : Configure pipeline Variables
87
88
id : vars
88
89
run : |
89
90
kindest_latest=$(curl -s "https://hub.docker.com/v2/repositories/kindest/node/tags" \
@@ -110,13 +111,7 @@ jobs:
110
111
./.github/scripts/variables.sh docker_md5 >> $GITHUB_OUTPUT
111
112
./.github/scripts/variables.sh build_tag >> $GITHUB_OUTPUT
112
113
./.github/scripts/variables.sh stable_tag >> $GITHUB_OUTPUT
113
- ref=${{ github.ref_name }}
114
- if [[ $ref =~ merge ]]; then
115
- additional_tag="pr-${ref%*/merge}"
116
- else
117
- additional_tag="${ref//\//-}"
118
- fi
119
- echo "additional_tag=${additional_tag}" >> $GITHUB_OUTPUT
114
+ REF=${{ github.ref_name }} ./.github/scripts/variables.sh additional_tag >> $GITHUB_OUTPUT
120
115
echo "image_matrix_oss=$(cat .github/data/matrix-images-oss.json | jq -c)" >> $GITHUB_OUTPUT
121
116
echo "image_matrix_plus=$(cat .github/data/matrix-images-plus.json | jq -c)" >> $GITHUB_OUTPUT
122
117
echo "image_matrix_nap=$(cat .github/data/matrix-images-nap.json | jq -c)" >> $GITHUB_OUTPUT
@@ -150,11 +145,26 @@ jobs:
150
145
- name : Check if stable image exists
151
146
id : stable_exists
152
147
run : |
148
+ exists=false
153
149
if docker pull gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic/nginx-ingress:${{ steps.vars.outputs.stable_tag }}; then
154
- echo " exists=true" >> $GITHUB_OUTPUT
150
+ exists=true
155
151
fi
152
+ echo "exists=${exists}" >> $GITHUB_OUTPUT
156
153
if : ${{ steps.vars.outputs.forked_workflow == 'false' }}
157
154
155
+ - name : Check if docker build is needed
156
+ id : docker_build
157
+ run : |
158
+ docker_build="false"
159
+ if [ "${{ inputs.force }}" = "true" ]; then
160
+ docker_build="true"
161
+ elif [ "$forked_workflow" = "true" ] && [ "${{ steps.docs.outputs.docs_only }}" = "false" ]; then
162
+ docker_build="true"
163
+ elif [ "$forked_workflow" = "false" ] && [ "${{ steps.docs.outputs.docs_only }}" = "false" ] && [ "${{ steps.stable_exists.outputs.exists }}" = "false" ]; then
164
+ docker_build="true"
165
+ fi
166
+ echo "docker_build=${docker_build}" >> $GITHUB_OUTPUT
167
+
158
168
- name : Output variables
159
169
run : |
160
170
echo docs_only: ${{ github.event.pull_request && steps.docs.outputs.docs_only == 'true' }}
@@ -173,6 +183,7 @@ jobs:
173
183
echo 'image_matrix_oss: ${{ steps.vars.outputs.image_matrix_oss }}'
174
184
echo 'image_matrix_plus: ${{ steps.vars.outputs.image_matrix_plus }}'
175
185
echo 'image_matrix_nap: ${{ steps.vars.outputs.image_matrix_nap }}'
186
+ echo 'docker_build: ${{ steps.docker_build.outputs.docker_build }}'
176
187
177
188
verify-codegen :
178
189
name : Verify generated code
@@ -200,7 +211,7 @@ jobs:
200
211
password ${{ secrets.ARTIFACTORY_TOKEN }}
201
212
EOF
202
213
chmod 600 $HOME/.netrc
203
- if : ${{ needs.checks.outputs.binary_cache_hit != 'true' && needs.checks.outputs.forked_workflow != 'true' }}
214
+ if : ${{ inputs.force || ( needs.checks.outputs.binary_cache_hit != 'true' && needs.checks.outputs.forked_workflow != 'true') }}
204
215
205
216
- name : Check if go.mod and go.sum are up to date
206
217
run : go mod tidy && git diff --exit-code -- go.mod go.sum
@@ -251,7 +262,7 @@ jobs:
251
262
password ${{ secrets.ARTIFACTORY_TOKEN }}
252
263
EOF
253
264
chmod 600 $HOME/.netrc
254
- if : ${{ needs.checks.outputs.binary_cache_hit != 'true' && needs.checks.outputs.forked_workflow != 'true' }}
265
+ if : ${{ inputs.force || ( needs.checks.outputs.binary_cache_hit != 'true' && needs.checks.outputs.forked_workflow != 'true') }}
255
266
256
267
- name : Run Tests
257
268
run : make cover
@@ -289,7 +300,7 @@ jobs:
289
300
uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
290
301
with :
291
302
go-version-file : go.mod
292
- if : ${{ ( inputs.force && inputs.force || false) || needs.checks.outputs.binary_cache_hit != 'true' }}
303
+ if : ${{ inputs.force || needs.checks.outputs.binary_cache_hit != 'true' }}
293
304
294
305
- name : Setup netrc
295
306
run : |
@@ -299,7 +310,7 @@ jobs:
299
310
password ${{ secrets.ARTIFACTORY_TOKEN }}
300
311
EOF
301
312
chmod 600 $HOME/.netrc
302
- if : ${{ needs.checks.outputs.binary_cache_hit != 'true' && needs.checks.outputs.forked_workflow != 'true' }}
313
+ if : ${{ inputs.force || ( needs.checks.outputs.binary_cache_hit != 'true' && needs.checks.outputs.forked_workflow != 'true') }}
303
314
304
315
- name : Build binaries
305
316
uses : goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
@@ -319,14 +330,14 @@ jobs:
319
330
AWS_NAP_WAF_DOS_PRODUCT_CODE : ${{ secrets.AWS_NAP_WAF_DOS_PRODUCT_CODE }}
320
331
AWS_NAP_WAF_DOS_PUB_KEY : ${{ secrets.AWS_NAP_WAF_DOS_PUB_KEY }}
321
332
GORELEASER_CURRENT_TAG : " v${{ needs.checks.outputs.ic_version }}"
322
- if : ${{ ( inputs.force && inputs.force || false) || needs.checks.outputs.binary_cache_hit != 'true' }}
333
+ if : ${{ inputs.force || needs.checks.outputs.binary_cache_hit != 'true' }}
323
334
324
335
- name : Store Artifacts in Cache
325
336
uses : actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
326
337
with :
327
338
path : ${{ github.workspace }}/dist
328
339
key : nginx-ingress-${{ needs.checks.outputs.go_code_md5 }}
329
- if : ${{ ( inputs.force && inputs.force || false) || needs.checks.outputs.binary_cache_hit != 'true' }}
340
+ if : ${{ inputs.force || needs.checks.outputs.binary_cache_hit != 'true' }}
330
341
331
342
build-docker :
332
343
name : Build Docker OSS
@@ -341,7 +352,7 @@ jobs:
341
352
go-md5 : ${{ needs.checks.outputs.go_code_md5 }}
342
353
base-image-md5 : ${{ needs.checks.outputs.docker_md5 }}
343
354
authenticated : ${{ needs.checks.outputs.forked_workflow != 'true' }}
344
- full-build : ${{ inputs.force && inputs.force || false }}
355
+ full-build : ${{ inputs.force }}
345
356
tag : ${{ needs.checks.outputs.build_tag }}
346
357
branch : ${{ (github.head_ref && needs.checks.outputs.forked_workflow != 'true') && github.head_ref || github.ref }}
347
358
ic-version : ${{ needs.checks.outputs.ic_version }}
@@ -352,7 +363,7 @@ jobs:
352
363
packages : write
353
364
pull-requests : write # for scout report
354
365
secrets : inherit
355
- if : ${{ inputs.force || ( needs.checks.outputs.forked_workflow == 'true' && needs.checks.outputs.docs_only == 'false') || (needs.checks.outputs.forked_workflow == 'false' && needs.checks.outputs.stable_image_exists != 'true' && needs.checks.outputs.docs_only == 'false') }}
366
+ if : ${{ needs.checks.outputs.docker_build == 'true' }}
356
367
357
368
build-docker-plus :
358
369
name : Build Docker Plus
@@ -370,14 +381,14 @@ jobs:
370
381
branch : ${{ (github.head_ref && needs.checks.outputs.forked_workflow != 'true') && github.head_ref || github.ref }}
371
382
tag : ${{ needs.checks.outputs.build_tag }}
372
383
authenticated : ${{ needs.checks.outputs.forked_workflow != 'true' }}
373
- full-build : ${{ inputs.force && inputs.force || false }}
384
+ full-build : ${{ inputs.force }}
374
385
ic-version : ${{ needs.checks.outputs.ic_version }}
375
386
permissions :
376
387
contents : read
377
388
id-token : write
378
389
pull-requests : write # for scout report
379
390
secrets : inherit
380
- if : ${{ inputs.force || ( needs.checks.outputs.forked_workflow == 'true' && needs.checks.outputs.docs_only == 'false') || (needs.checks.outputs.forked_workflow == 'false' && needs.checks.outputs.stable_image_exists != 'true' && needs.checks.outputs.docs_only == 'false') }}
391
+ if : ${{ needs.checks.outputs.docker_build == 'true' }}
381
392
382
393
build-docker-nap :
383
394
name : Build Docker NAP
@@ -396,14 +407,14 @@ jobs:
396
407
tag : ${{ needs.checks.outputs.build_tag }}
397
408
nap-modules : ${{ matrix.nap_modules }}
398
409
authenticated : ${{ needs.checks.outputs.forked_workflow != 'true' }}
399
- full-build : ${{ inputs.force && inputs.force || false }}
410
+ full-build : ${{ inputs.force }}
400
411
ic-version : ${{ needs.checks.outputs.ic_version }}
401
412
permissions :
402
413
contents : read
403
414
id-token : write # gcr login
404
415
pull-requests : write # for scout report
405
416
secrets : inherit
406
- if : ${{ inputs.force || ( needs.checks.outputs.forked_workflow == 'true' && needs.checks.outputs.docs_only == 'false') || (needs.checks.outputs.forked_workflow == 'false' && needs.checks.outputs.stable_image_exists != 'true' && needs.checks.outputs.docs_only == 'false') }}
417
+ if : ${{ needs.checks.outputs.docker_build == 'true' }}
407
418
408
419
tag-target :
409
420
name : Tag untested image with PR number
@@ -706,6 +717,7 @@ jobs:
706
717
stable-tag : ${{ needs.checks.outputs.stable_tag }}
707
718
authenticated : ${{ needs.checks.outputs.forked_workflow != 'true' }}
708
719
k8s-version : ${{ matrix.k8s }}
720
+ force : ${{ inputs.run_tests }}
709
721
710
722
smoke-tests-plus :
711
723
if : ${{ inputs.force || (inputs.run_tests && inputs.run_tests || true) || needs.checks.outputs.docs_only != 'true' }}
@@ -733,6 +745,7 @@ jobs:
733
745
stable-tag : ${{ needs.checks.outputs.stable_tag }}
734
746
authenticated : ${{ needs.checks.outputs.forked_workflow != 'true' }}
735
747
k8s-version : ${{ matrix.k8s }}
748
+ force : ${{ inputs.run_tests }}
736
749
737
750
smoke-tests-nap :
738
751
if : ${{ inputs.force || (inputs.run_tests && inputs.run_tests || true) || needs.checks.outputs.docs_only != 'true' }}
@@ -760,6 +773,7 @@ jobs:
760
773
stable-tag : ${{ needs.checks.outputs.stable_tag }}
761
774
authenticated : ${{ needs.checks.outputs.forked_workflow != 'true' }}
762
775
k8s-version : ${{ matrix.k8s }}
776
+ force : ${{ inputs.run_tests }}
763
777
764
778
tag-stable :
765
779
name : Tag tested image as stable
@@ -835,4 +849,4 @@ jobs:
835
849
pull-requests : write # for scout report
836
850
uses : ./.github/workflows/image-promotion.yml
837
851
secrets : inherit
838
- if : ${{ inputs.force && inputs.force || false }}
852
+ if : ${{ inputs.force }}
0 commit comments