2020 env :
2121 CRANE_VERSION : v0.20.5
2222 CRANE_CHECKSUM : ad4cd9af2568c62c97e346de6d1295ee8c6ce3341f7b71cf02d41292b4532680
23+ COMPONENT : ${{ inputs.component }}
24+ ARCH : ${{ inputs.arch }}
25+ GH_REF : ${{ github.ref }}
2326
2427 steps :
2528 - name : Install cosign
@@ -50,28 +53,28 @@ jobs:
5053 working-directory : ${{ runner.temp }}/digests
5154 run : |
5255 set -e
53- DIGEST=$(cat ${{ inputs.component }} -${{ inputs.arch }} .txt)
56+ DIGEST=$(cat "${COMPONENT} -${ARCH} .txt" )
5457 echo "DIGEST=${DIGEST}" >> "$GITHUB_ENV"
5558 - name : Find attestation digest
5659 run : |
5760 set -e
58- DIGEST=$(crane manifest ghcr.io/${{ github.repository_owner }}/sbomscanner/${{ inputs.component }} @${{ env. DIGEST }} \
61+ DIGEST=$(crane manifest " ghcr.io/${{ github.repository_owner }}/sbomscanner/${COMPONENT} @${DIGEST}" \
5962 | jq -r '.manifests[]
6063 | select(.annotations["vnd.docker.reference.type"] == "attestation-manifest")
6164 | .digest')
6265 echo "ATTESTATION_MANIFEST_DIGEST=${DIGEST}" >> "$GITHUB_ENV"
6366 - name : Find provenance manifest digest
6467 run : |
6568 set -e
66- DIGEST=$(crane manifest ghcr.io/${{ github.repository_owner }}/sbomscanner/${{ inputs.component }} @${{ env. ATTESTATION_MANIFEST_DIGEST }} |
69+ DIGEST=$(crane manifest " ghcr.io/${{ github.repository_owner }}/sbomscanner/${COMPONENT} @${ATTESTATION_MANIFEST_DIGEST}" |
6770 jq -r '.layers[]
6871 | select(.annotations["in-toto.io/predicate-type"] == "https://slsa.dev/provenance/v1")
6972 | .digest')
7073 echo "PROVENANCE_DIGEST=${DIGEST}" >> "$GITHUB_ENV"
7174 - name : Find SBOM manifest layer digest
7275 run : |
7376 set -e
74- DIGEST=$(crane manifest ghcr.io/${{github.repository_owner}}/sbomscanner/${{ inputs.component }} @${{ env. ATTESTATION_MANIFEST_DIGEST}} | \
77+ DIGEST=$(crane manifest " ghcr.io/${{github.repository_owner}}/sbomscanner/${COMPONENT} @${ATTESTATION_MANIFEST_DIGEST}" | \
7578 jq '.layers | map(select(.annotations["in-toto.io/predicate-type"] == "https://spdx.dev/Document")) | map(.digest) | join(" ")')
7679 echo "SBOM_DIGEST=${DIGEST}" >> "$GITHUB_ENV"
7780
@@ -81,30 +84,30 @@ jobs:
8184 - name : Download provenance and SBOM files
8285 run : |
8386 set -e
84- crane blob ghcr.io/${{github.repository_owner}}/sbomscanner/${{ inputs.component }} @${{ env. PROVENANCE_DIGEST}} \
85- > SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -provenance.intoto.jsonl
86- crane blob ghcr.io/${{github.repository_owner}}/sbomscanner/${{ inputs.component }} @${{ env. SBOM_DIGEST}} \
87- > SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -sbom.json
87+ crane blob " ghcr.io/${{github.repository_owner}}/sbomscanner/${COMPONENT} @${PROVENANCE_DIGEST}" \
88+ > " SBOMscanner-${COMPONENT} -attestation-${ARCH} -provenance.intoto.jsonl"
89+ crane blob " ghcr.io/${{github.repository_owner}}/sbomscanner/${COMPONENT} @${SBOM_DIGEST}" \
90+ > " SBOMscanner-${COMPONENT} -attestation-${ARCH} -sbom.json"
8891 - name : Sign provenance and SBOM files
8992 run : |
9093 set -e
9194 cosign sign-blob --yes \
92- --bundle SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -provenance.intoto.jsonl.bundle.sigstore \
93- SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -provenance.intoto.jsonl
95+ --bundle " SBOMscanner-${COMPONENT} -attestation-${ARCH} -provenance.intoto.jsonl.bundle.sigstore" \
96+ " SBOMscanner-${COMPONENT} -attestation-${ARCH} -provenance.intoto.jsonl"
9497 cosign verify-blob \
95- --bundle SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -provenance.intoto.jsonl.bundle.sigstore \
98+ --bundle " SBOMscanner-${COMPONENT} -attestation-${ARCH} -provenance.intoto.jsonl.bundle.sigstore" \
9699 --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
97- --certificate-identity="https://github.com/${{github.repository_owner}}/sbomscanner/.github/workflows/attestation.yml@${{ github.ref } }" \
98- SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -provenance.intoto.jsonl
100+ --certificate-identity="https://github.com/${{github.repository_owner}}/sbomscanner/.github/workflows/attestation.yml@${GH_REF }" \
101+ " SBOMscanner-${COMPONENT} -attestation-${ARCH} -provenance.intoto.jsonl"
99102
100103 cosign sign-blob --yes \
101- --bundle SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -sbom.json.bundle.sigstore \
102- SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -sbom.json
104+ --bundle " SBOMscanner-${COMPONENT} -attestation-${ARCH} -sbom.json.bundle.sigstore" \
105+ " SBOMscanner-${COMPONENT} -attestation-${ARCH} -sbom.json"
103106 cosign verify-blob \
104- --bundle SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -sbom.json.bundle.sigstore \
107+ --bundle " SBOMscanner-${COMPONENT} -attestation-${ARCH} -sbom.json.bundle.sigstore" \
105108 --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
106- --certificate-identity="https://github.com/${{github.repository_owner}}/sbomscanner/.github/workflows/attestation.yml@${{ github.ref } }" \
107- SBOMscanner-${{ inputs.component }} -attestation-${{ inputs.arch }} -sbom.json
109+ --certificate-identity="https://github.com/${{github.repository_owner}}/sbomscanner/.github/workflows/attestation.yml@${GH_REF }" \
110+ " SBOMscanner-${COMPONENT} -attestation-${ARCH} -sbom.json"
108111
109112 - name : Upload SBOMs as artifacts
110113 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
0 commit comments