Skip to content

Commit 1c6932a

Browse files
committed
Backport image scan patch
1 parent 9953157 commit 1c6932a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
145145
- name: Install Trivy
146146
run: |
147-
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin v0.49.0
147+
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin v0.67.2
148148
149149
- name: Install yq
150150
run: |
@@ -164,7 +164,7 @@ jobs:
164164
- name: Install Docker Python SDK
165165
run: |
166166
sudo pip install docker 'requests<2.32.0'
167-
167+
168168
- name: Get Kolla tag
169169
id: write-kolla-tag
170170
run: echo "kolla-tag=${{ needs.generate-tag.outputs.openstack_release }}-${{ matrix.distro }}-${{ matrix.distro == 'rocky' && '9' || 'jammy' }}-${{ needs.generate-tag.outputs.datetime_tag }}" >> $GITHUB_OUTPUT

tools/scan-images.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -u
1111

1212
# Check that trivy is installed
1313
if ! trivy --version; then
14-
echo 'Please install trivy: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.49.1'
14+
echo 'Please install trivy: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.67.2'
1515
fi
1616

1717
# Clear any previous outputs
@@ -21,10 +21,12 @@ rm -rf image-scan-output
2121
mkdir -p image-scan-output
2222

2323
# Get built container images
24-
docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$2" > $1-scanned-container-images.txt
24+
images=$(docker image ls \
25+
--filter "reference=ark.stackhpc.com/stackhpc-dev/*:$2*" \
26+
--format "{{.Repository}}:{{.Tag}}")
2527

26-
# Make a file of imagename:tag
27-
images=$(grep --invert-match --no-filename ^REPOSITORY $1-scanned-container-images.txt | sed 's/ \+/:/g' | cut -f 1,2 -d:)
28+
# Save list of images to file
29+
echo "$images" > "$1-scanned-container-images.txt"
2830

2931
# Ensure output files exist
3032
touch image-scan-output/clean-images.txt image-scan-output/dirty-images.txt image-scan-output/critical-images.txt

0 commit comments

Comments
 (0)