Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/attestation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,38 @@ jobs:
| jq -r '.manifests[]
| select(.annotations["vnd.docker.reference.type"] == "attestation-manifest")
| .digest')
if [[ -z "${DIGEST}" ]]; then
echo "ERROR: No attestation manifest found for ${{ inputs.component }} (${{ inputs.arch }})"
exit 1
fi
echo "ATTESTATION_MANIFEST_DIGEST=${DIGEST}" >> "$GITHUB_ENV"
- name: Find provenance manifest digest
run: |
set -e
DIGEST=$(crane manifest ghcr.io/${{ github.repository_owner }}/${{ inputs.component }}@${{ env.ATTESTATION_MANIFEST_DIGEST }} |
jq -r '.layers[]
| select(.annotations["in-toto.io/predicate-type"] == "https://slsa.dev/provenance/v0.2")
| select(.annotations["in-toto.io/predicate-type"] == "https://slsa.dev/provenance/v1")
| .digest')
if [[ -z "${DIGEST}" ]]; then
echo "ERROR: No SLSA provenance layer found in attestation manifest for ${{ inputs.component }} (${{ inputs.arch }})"
exit 1
fi
echo "PROVENANCE_DIGEST=${DIGEST}" >> "$GITHUB_ENV"
- name: Find SBOM manifest layer digest
run: |
set -e
DIGEST=$(crane manifest ghcr.io/${{github.repository_owner}}/${{ inputs.component }}@${{ env.ATTESTATION_MANIFEST_DIGEST}} | \
jq '.layers | map(select(.annotations["in-toto.io/predicate-type"] == "https://spdx.dev/Document")) | map(.digest) | join(" ")')
DIGEST=$(crane manifest ghcr.io/${{github.repository_owner}}/${{ inputs.component }}@${{ env.ATTESTATION_MANIFEST_DIGEST}} | \
jq -r '.layers
| map(select(.annotations["in-toto.io/predicate-type"] == "https://spdx.dev/Document"))
| map(.digest)
| if length == 0 then empty
elif length == 1 then .[0]
else error("ERROR: Multiple SBOM layers found in attestation manifest")
end')
if [[ -z "${DIGEST}" ]]; then
echo "ERROR: No SBOM layer found in attestation manifest for ${{ inputs.component }} (${{ inputs.arch }})"
exit 1
fi
echo "SBOM_DIGEST=${DIGEST}" >> "$GITHUB_ENV"

# We need to upload provenance and SBOM files, plus their signatures under the GitHub Release page.
Expand Down
Loading