3939 required : false
4040 default : true
4141 push-dirty :
42- description : Push scanned images that have vulnerabilities?
42+ description : Push scanned images that have critical vulnerabilities?
4343 type : boolean
4444 required : false
45- # NOTE(Alex-Welsh): This default should be flipped once we resolve existing failures
46- default : true
45+ default : false
4746
4847env :
4948 ANSIBLE_FORCE_COLOR : True
@@ -181,7 +180,7 @@ jobs:
181180 KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
182181
183182 - name : Create build logs output directory
184- run : mkdir image-build-logs
183+ run : mkdir image-build-logs
185184
186185 - name : Build kolla overcloud images
187186 id : build_overcloud_images
@@ -240,9 +239,16 @@ jobs:
240239 run : cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
241240 if : inputs.push
242241
242+ # NOTE(seunghun1ee): This always appends dirty images with CVEs severity lower than critical.
243+ # This should be reverted when it's decided to filter high level CVEs as well.
243244 - name : Append dirty images to push list
244245 run : |
245246 cat image-build-logs/image-scan-output/dirty-images.txt >> image-build-logs/push-attempt-images.txt
247+ if : ${{ inputs.push }}
248+
249+ - name : Append images with critical vulnerabilities to push list
250+ run : |
251+ cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
246252 if : ${{ inputs.push && inputs.push-dirty }}
247253
248254 - name : Push images
@@ -254,7 +260,7 @@ jobs:
254260
255261 while read -r image; do
256262 # Retries!
257- for i in {1..5}; do
263+ for i in {1..5}; do
258264 if docker push $image; then
259265 echo "Pushed $image"
260266 break
@@ -288,8 +294,15 @@ jobs:
288294 run : if [ $(wc -l < image-build-logs/push-failed-images.txt) -gt 0 ]; then cat image-build-logs/push-failed-images.txt && exit 1; fi
289295 if : ${{ !cancelled() }}
290296
291- - name : Fail when images failed scanning
292- run : if [ $(wc -l < image-build-logs/dirty-images.txt) -gt 0 ]; then cat image-build-logs/dirty-images.txt && exit 1; fi
297+ # NOTE(seunghun1ee): Currently we want to mark the job fail only when critical CVEs are detected.
298+ # This can be used again instead of "Fail when critical vulnerabilities are found" when it's
299+ # decided to fail the job on detecting high CVEs as well.
300+ # - name: Fail when images failed scanning
301+ # run: if [ $(wc -l < image-build-logs/image-scan-output/dirty-images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/dirty-images.txt && exit 1; fi
302+ # if: ${{ !inputs.push-dirty && !cancelled() }}
303+
304+ - name : Fail when critical vulnerabilities are found
305+ run : if [ $(wc -l < image-build-logs/image-scan-output/critical-images.txt) -gt 0 ]; then cat image-build-logs/image-scan-output/critical-images.txt && exit 1; fi
293306 if : ${{ !inputs.push-dirty && !cancelled() }}
294307
295308 # NOTE(mgoddard): Trigger another CI workflow in the
0 commit comments