Skip to content

Commit c85c6f5

Browse files
CopilotdevakesuCopilot
authored
Fix gh attestation download: remove unsupported --format flag (#380)
* Initial plan * Fix gh attestation download command by removing unsupported --format flag Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Fix attestation file lookup to use glob pattern instead of direct digest Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Devanarayanan <fusion@devakesu.com> * Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Devanarayanan <fusion@devakesu.com> --------- Signed-off-by: Devanarayanan <fusion@devakesu.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> Co-authored-by: Devanarayanan <fusion@devakesu.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c86f2ce commit c85c6f5

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,30 @@ jobs:
338338
339339
if gh attestation download \
340340
oci://ghcr.io/${{ github.repository_owner }}/${{ steps.prep.outputs.image_name }}@${{ steps.build-push.outputs.digest }} \
341-
--owner ${{ github.repository_owner }} \
342-
--format json > provenance.intoto.json; then
343-
echo "✓ SLSA provenance attestation downloaded successfully"
344-
ls -lh provenance.intoto.json
345-
exit 0
341+
--owner ${{ github.repository_owner }}; then
342+
# gh attestation download creates a file named after the digest (e.g., sha256:abc123.jsonl or sha256-abc123.jsonl on Windows)
343+
# Find and rename it to a consistent name for easier reference, without using ls|head under set -euo pipefail
344+
shopt -s nullglob
345+
digest_files=(sha256*.jsonl)
346+
if [ ${#digest_files[@]} -gt 0 ]; then
347+
DIGEST_FILE="${digest_files[0]}"
348+
else
349+
DIGEST_FILE=""
350+
fi
351+
if [ -n "$DIGEST_FILE" ]; then
352+
mv "$DIGEST_FILE" provenance.intoto.jsonl
353+
echo "✓ SLSA provenance attestation downloaded successfully"
354+
ls -lh provenance.intoto.jsonl
355+
exit 0
356+
else
357+
echo "⚠ Could not find downloaded attestation file"
358+
echo "Current directory contents:"
359+
ls -la
360+
echo "Waiting ${SLEEP_TIME}s before retry..."
361+
sleep $SLEEP_TIME
362+
ATTEMPT=$((ATTEMPT + 1))
363+
continue
364+
fi
346365
else
347366
echo "⚠ Download failed, waiting ${SLEEP_TIME}s before retry..."
348367
sleep $SLEEP_TIME
@@ -443,7 +462,7 @@ jobs:
443462
sha256sum sbom.json.bundle >> checksums.txt
444463
echo "" >> checksums.txt
445464
echo "## SLSA Provenance Attestation" >> checksums.txt
446-
sha256sum provenance.intoto.json >> checksums.txt
465+
sha256sum provenance.intoto.jsonl >> checksums.txt
447466
echo "" >> checksums.txt
448467
echo "Generated at: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> checksums.txt
449468
echo "" >> checksums.txt
@@ -458,7 +477,7 @@ jobs:
458477
sbom.json
459478
sbom.json.bundle
460479
checksums.txt
461-
provenance.intoto.json
480+
provenance.intoto.jsonl
462481
463482
# Create GitHub Release with artifacts
464483
create-github-release:
@@ -645,7 +664,7 @@ jobs:
645664
./artifacts/sbom.json.bundle \
646665
./artifacts/checksums.txt \
647666
./artifacts/VERIFY.md \
648-
./artifacts/provenance.intoto.json \
667+
./artifacts/provenance.intoto.jsonl \
649668
--draft=false
650669
651670
# Deploy to production after successful release creation

0 commit comments

Comments
 (0)