Name the scan image after the run, not the commit

A repo and its push mirrors build the same commit at the same time on
the same Docker daemon. With the SHA in the temporary tag, one job
removed the image the other was still scanning ("No such image:
trivy-scan:<sha>-linux-amd64" in kj/scm-manager).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
thomas.gloorandClaude Opus 5.5 committed 2026-10-26 12:41:31 +01:00
1 parent ae1e1bacb3
commit bff2d0e96a
1 file changed
+3 -1
+3 -1
View File
@@ -119,7 +119,9 @@ jobs:
status=0
for platform in "${platforms[@]}"; do
tag="trivy-scan:${GITHUB_SHA}-${platform//\//-}"
# Unique per run: mirrored repos build the same commit at the same
# time on the same Docker daemon, so the SHA alone would collide.
tag="trivy-scan:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-1}-${platform//\//-}"
echo "::group::Build $platform"
docker buildx build --platform "$platform" --load --pull \