Skip to content

Commit 843cdd8

Browse files
authored
fix: Collect provenance digests regardless of artifact layout (#1566)
1 parent cff16b9 commit 843cdd8

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/reusable_build_image.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,18 @@ jobs:
268268
set -euo pipefail
269269
IMAGE="${IMAGE_NAME:-$PRODUCT_NAME}"
270270
271+
# Collect every digests.json regardless of the directory layout that
272+
# download-artifact produces.
273+
readarray -t DIGEST_FILES < <(find artifacts -type f -name digests.json)
274+
275+
# No digests recorded means nothing to attach provenance to. Guard here
276+
# because jq with no file arguments would block reading from stdin.
277+
if [ "${#DIGEST_FILES[@]}" -eq 0 ]; then
278+
echo "matrix={\"include\":[]}" | tee -a "$GITHUB_OUTPUT"
279+
echo "has_entries=false" | tee -a "$GITHUB_OUTPUT"
280+
exit 0
281+
fi
282+
271283
# Build a JSON matrix include array. Each version contributes one entry
272284
# for oci.stackable.tech and, if a quay digest was recorded, one for
273285
# quay.io. The slsa generator attaches provenance by digest, so no tag
@@ -286,7 +298,7 @@ jobs:
286298
digest: .quay_digest,
287299
username: ("stackable+robot_" + $ns + "_github_action_build") }
288300
else empty end )
289-
]' artifacts/*/digests.json)
301+
]' "${DIGEST_FILES[@]}")
290302
291303
echo "matrix={\"include\":$INCLUDE}" | tee -a "$GITHUB_OUTPUT"
292304
if [ "$INCLUDE" = "[]" ]; then

0 commit comments

Comments
 (0)