Skip to content

Commit c507c73

Browse files
committed
Add new step to fail job on critical CVE detection
1 parent bf4ad82 commit c507c73

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ on:
4242
description: Push scanned images that have 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

4847
env:
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
@@ -254,7 +253,7 @@ jobs:
254253
255254
while read -r image; do
256255
# Retries!
257-
for i in {1..5}; do
256+
for i in {1..5}; do
258257
if docker push $image; then
259258
echo "Pushed $image"
260259
break
@@ -288,8 +287,15 @@ jobs:
288287
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
289288
if: ${{ !cancelled() }}
290289

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
290+
# NOTE(seunghun1ee): Currently we want to mark the job fail only when critical CVEs are detected.
291+
# This can be used again instead of "Fail when critical vulnerabilities are found" when it's
292+
# decided to fail the job on detecting high CVEs as well.
293+
# - name: Fail when images failed scanning
294+
# 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
295+
# if: ${{ !inputs.push-dirty && !cancelled() }}
296+
297+
- name: Fail when critical vulnerabilities are found
298+
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
293299
if: ${{ !inputs.push-dirty && !cancelled() }}
294300

295301
# NOTE(mgoddard): Trigger another CI workflow in the

0 commit comments

Comments
 (0)