Skip to content

Commit aee7f43

Browse files
committed
WIP: try pushing sbom
1 parent b568f4a commit aee7f43

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ jobs:
170170
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
171171
curl -sL "https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_${ARCH}.tar.gz" | tar xz && sudo mv yq_linux_${ARCH} /usr/bin/yq
172172
173+
- name: Install regctl
174+
run: |
175+
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
176+
declare -A regctl_checksums
177+
regctl_checksums+=([amd64]=d3de5d4e1bc4d771a56a835294f597815b67bb6c0c32462a8aa880e2ba831620 [arm64]=7caec09213a98e9e1b3c5f8aa4cfa1b6c12b5e3e96bfbb441b2289a4e6ba9758)
178+
wget https://github.com/regclient/regclient/releases/download/v0.11.1/"regctl-linux-${ARCH}"
179+
sha256sum -c <<<"${regctl_checksums[$ARCH]} regctl-linux-${ARCH}" || exit 1
180+
chmod +x "regctl-linux-${ARCH}"
181+
sudo mv "regctl-linux-${ARCH} /usr/bin/regctl
182+
173183
- name: Install Kayobe
174184
run: |
175185
mkdir -p venvs &&
@@ -298,10 +308,18 @@ jobs:
298308
kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/docker-registry-login.yml &&
299309
300310
while read -r image; do
311+
filename=$(basename "$image" | sed 's/:/\./g')
312+
imagename=$(echo "$filename" | cut -d "." -f 1 | sed 's/-/_/g')
313+
sbom="image-build-logs/image-scan-output/${imagename}/${filename}-sbom.json"
301314
# Retries!
302315
for i in {1..5}; do
303316
if docker push $image; then
304317
echo "Pushed $image"
318+
if [ -f "$sbom" ]; then
319+
echo "Pushing sbom for $image"
320+
regctl -v debug artifact put --artifact-type application/spdx+json --subject "$image" < "$sbom"
321+
echo "Pushed sbom for $image"
322+
fi
305323
break
306324
elif [ $i -eq 5 ] ; then
307325
echo "Failed to push $image"

0 commit comments

Comments
 (0)