Skip to content

Commit 9c4c16e

Browse files
committed
Fix image push condition
1 parent c507c73 commit 9c4c16e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ on:
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
4545
default: false
@@ -239,9 +239,16 @@ jobs:
239239
run: cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
240240
if: inputs.push
241241

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.
242244
- name: Append dirty images to push list
243245
run: |
244246
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
245252
if: ${{ inputs.push && inputs.push-dirty }}
246253

247254
- name: Push images

tools/scan-images.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ for image in $images; do
5151
# Add the image to the clean list
5252
echo "${image}" >> image-scan-output/clean-images.txt
5353
else
54-
# Add the image to the dirty list
55-
echo "${image}" >> image-scan-output/dirty-images.txt
5654

5755
# Write a header for the summary CSV
5856
echo '"PkgName","PkgPath","PkgID","VulnerabilityID","FixedVersion","PrimaryURL","Severity"' > image-scan-output/${filename}.summary.csv
@@ -81,6 +79,9 @@ for image in $images; do
8179
if [ $(grep "CRITICAL" image-scan-output/${filename}.summary.csv -c) -gt 0 ]; then
8280
# If the image contains critical vulnerabilities, add the image to critical list
8381
echo "${image}" >> image-scan-output/critical-images.txt
82+
else
83+
# Otherwise, add the image to the dirty list
84+
echo "${image}" >> image-scan-output/dirty-images.txt
8485
fi
8586
fi
8687
done

0 commit comments

Comments
 (0)