From bc06f2f2e651f9d9e40f8a2d708ef7a5891225df Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Fri, 11 Jul 2025 12:14:52 +0200 Subject: [PATCH] Fix sbom for docker image Signed-off-by: Bryan Frimin --- .github/workflows/release.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9a3f452bd..2af03f142 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -98,8 +98,21 @@ jobs: - name: Get image digest id: image run: | - # Extract image digest from goreleaser output - echo "digest=$(docker inspect ghcr.io/getprobo/probo:${{ github.ref_name }} --format='{{index .RepoDigests 0}}' | cut -d'@' -f2)" >> "$GITHUB_OUTPUT" + # Get the digest from the registry using docker buildx imagetools + DIGEST=$(docker buildx imagetools inspect ghcr.io/getprobo/probo:${{ github.ref_name }} --format '{{.Manifest.Digest}}' 2>/dev/null || echo "") + + if [ -z "$DIGEST" ]; then + echo "Failed to get digest from registry, trying alternative method..." + # Alternative: use the latest tag if version-specific tag fails + DIGEST=$(docker buildx imagetools inspect ghcr.io/getprobo/probo:latest --format '{{.Manifest.Digest}}' 2>/dev/null || echo "") + fi + + if [ -z "$DIGEST" ]; then + echo "Error: Could not retrieve image digest from registry" + exit 1 + fi + + echo "digest=$DIGEST" >> "$GITHUB_OUTPUT" - name: Attest Docker image SBOM uses: actions/attest-sbom@v1