3434 required : false
3535 default : true
3636 push-dirty :
37- description : Push scanned images that have vulnerabilities?
37+ description : Push scanned images that have critical vulnerabilities?
3838 type : boolean
3939 required : false
40- # NOTE(Alex-Welsh): This default should be flipped once we resolve existing failures
41- default : true
40+ default : false
4241
4342env :
4443 ANSIBLE_FORCE_COLOR : True
@@ -176,7 +175,7 @@ jobs:
176175 KAYOBE_VAULT_PASSWORD : ${{ secrets.KAYOBE_VAULT_PASSWORD }}
177176
178177 - name : Create build logs output directory
179- run : mkdir image-build-logs
178+ run : mkdir image-build-logs
180179
181180 - name : Build kolla overcloud images
182181 id : build_overcloud_images
@@ -235,9 +234,16 @@ jobs:
235234 run : cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
236235 if : inputs.push
237236
237+ # NOTE(seunghun1ee): This always appends dirty images with CVEs severity lower than critical.
238+ # This should be reverted when it's decided to filter high level CVEs as well.
238239 - name : Append dirty images to push list
239240 run : |
240241 cat image-build-logs/image-scan-output/dirty-images.txt >> image-build-logs/push-attempt-images.txt
242+ if : ${{ inputs.push }}
243+
244+ - name : Append images with critical vulnerabilities to push list
245+ run : |
246+ cat image-build-logs/image-scan-output/critical-images.txt >> image-build-logs/push-attempt-images.txt
241247 if : ${{ inputs.push && inputs.push-dirty }}
242248
243249 - name : Push images
@@ -249,7 +255,7 @@ jobs:
249255
250256 while read -r image; do
251257 # Retries!
252- for i in {1..5}; do
258+ for i in {1..5}; do
253259 if docker push $image; then
254260 echo "Pushed $image"
255261 break
@@ -283,8 +289,15 @@ jobs:
283289 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
284290 if : ${{ !cancelled() }}
285291
286- - name : Fail when images failed scanning
287- run : if [ $(wc -l < image-build-logs/dirty-images.txt) -gt 0 ]; then cat image-build-logs/dirty-images.txt && exit 1; fi
292+ # NOTE(seunghun1ee): Currently we want to mark the job fail only when critical CVEs are detected.
293+ # This can be used again instead of "Fail when critical vulnerabilities are found" when it's
294+ # decided to fail the job on detecting high CVEs as well.
295+ # - name: Fail when images failed scanning
296+ # 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
297+ # if: ${{ !inputs.push-dirty && !cancelled() }}
298+
299+ - name : Fail when critical vulnerabilities are found
300+ 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
288301 if : ${{ !inputs.push-dirty && !cancelled() }}
289302
290303 # NOTE(mgoddard): Trigger another CI workflow in the
0 commit comments