Skip to content

Commit 2e2fd7a

Browse files
authored
Merge pull request #1229 from flavio/ci-fix-provenance-signature
ci: fix attestation generation
2 parents add546c + d92f3d8 commit 2e2fd7a

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -115,47 +115,45 @@ jobs:
115115
jq '.layers[] | select(.annotations["in-toto.io/predicate-type"] == "https://slsa.dev/provenance/v0.2") | .digest')
116116
echo "PROVENANCE_DIGEST=${DIGEST}" >> "$GITHUB_ENV"
117117
118-
- name: Sign provenance manifest
119-
run: |
120-
cosign sign --yes \
121-
ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.PROVENANCE_DIGEST}}
122-
123-
cosign verify \
124-
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
125-
--certificate-identity="https://github.com/${{github.repository_owner}}/kubewarden-controller/.github/workflows/release.yml@${{ github.ref }}" \
126-
ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.PROVENANCE_DIGEST}}
127-
128118
- name: Find SBOM manifest layer digest
129119
run: |
130120
set -e
131121
DIGEST=$(crane manifest ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.ATTESTATION_MANIFEST_DIGEST}} | \
132122
jq '.layers | map(select(.annotations["in-toto.io/predicate-type"] == "https://spdx.dev/Document")) | map(.digest) | join(" ")')
133123
echo "SBOM_DIGEST=${DIGEST}" >> "$GITHUB_ENV"
134124
125+
# We need to upload provenance and SBOM files, plus their signatures under the GitHub Release page.
126+
# Moreover, the files have to be named in a certain way.
127+
# This is required by [ossf](https://github.com/ossf/scorecard/blob/main/docs/checks.md#signed-releases)
135128
- name: Download provenance and SBOM files
136129
run: |
137130
set -e
138131
crane blob ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.PROVENANCE_DIGEST}} \
139-
> kubewarden-controller-attestation-${{ matrix.arch }}-provenance.json
140-
sha256sum kubewarden-controller-attestation-${{ matrix.arch }}-provenance.json \
141-
>> kubewarden-controller-attestation-${{ matrix.arch }}-checksum.txt
132+
> kubewarden-controller-attestation-${{ matrix.arch }}-provenance.intoto.jsonl
142133
143134
crane blob ghcr.io/${{github.repository_owner}}/kubewarden-controller@${{ env.SBOM_DIGEST}} \
144135
> kubewarden-controller-attestation-${{ matrix.arch }}-sbom.json
145-
sha256sum kubewarden-controller-attestation-${{ matrix.arch }}-sbom.json \
146-
>> kubewarden-controller-attestation-${{ matrix.arch }}-checksum.txt
147136
148-
- name: Sign checksum file
137+
- name: Sign provenance and SBOM files
149138
run: |
139+
set -e
150140
cosign sign-blob --yes \
151-
--bundle kubewarden-controller-attestation-${{ matrix.arch }}-checksum-cosign.bundle \
152-
kubewarden-controller-attestation-${{ matrix.arch }}-checksum.txt
141+
--bundle kubewarden-controller-attestation-${{ matrix.arch }}-provenance.intoto.jsonl.bundle.sigstore \
142+
kubewarden-controller-attestation-${{ matrix.arch }}-provenance.intoto.jsonl
143+
cosign verify-blob \
144+
--bundle kubewarden-controller-attestation-${{ matrix.arch }}-provenance.intoto.jsonl.bundle.sigstore \
145+
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
146+
--certificate-identity="https://github.com/${{github.repository_owner}}/kubewarden-controller/.github/workflows/release.yml@${{ github.ref }}" \
147+
kubewarden-controller-attestation-${{ matrix.arch }}-provenance.intoto.jsonl
153148
149+
cosign sign-blob --yes \
150+
--bundle kubewarden-controller-attestation-${{ matrix.arch }}-sbom.json.bundle.sigstore \
151+
kubewarden-controller-attestation-${{ matrix.arch }}-sbom.json
154152
cosign verify-blob \
155-
--bundle kubewarden-controller-attestation-${{ matrix.arch }}-checksum-cosign.bundle \
153+
--bundle kubewarden-controller-attestation-${{ matrix.arch }}-sbom.json.bundle.sigstore \
156154
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
157155
--certificate-identity="https://github.com/${{github.repository_owner}}/kubewarden-controller/.github/workflows/release.yml@${{ github.ref }}" \
158-
kubewarden-controller-attestation-${{ matrix.arch }}-checksum.txt
156+
kubewarden-controller-attestation-${{ matrix.arch }}-sbom.json
159157
160158
- name: Upload SBOMs as artifacts
161159
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -252,12 +250,6 @@ jobs:
252250
- name: Display structure of downloaded files
253251
run: ls -R
254252

255-
- name: Create tarball for the attestation files
256-
run: |
257-
for arch in "amd64" "arm64"; do
258-
tar -czf attestation-$arch.tar.gz $(ls kubewarden-controller-attestation-$arch-*)
259-
done
260-
261253
- name: Upload release assets
262254
id: upload_release_assets
263255
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
@@ -267,8 +259,14 @@ jobs:
267259
let path = require('path');
268260
269261
let files = [
270-
'attestation-amd64.tar.gz',
271-
'attestation-arm64.tar.gz',
262+
'kubewarden-controller-attestation-amd64-provenance.intoto.jsonl',
263+
'kubewarden-controller-attestation-amd64-provenance.intoto.jsonl.bundle.sigstore',
264+
'kubewarden-controller-attestation-arm64-provenance.intoto.jsonl',
265+
'kubewarden-controller-attestation-arm64-provenance.intoto.jsonl.bundle.sigstore',
266+
'kubewarden-controller-attestation-amd64-sbom.json',
267+
'kubewarden-controller-attestation-amd64-sbom.json.bundle.sigstore',
268+
'kubewarden-controller-attestation-arm64-sbom.json',
269+
'kubewarden-controller-attestation-arm64-sbom.json.bundle.sigstore',
272270
"CRDS.tar.gz"]
273271
const {RELEASE_ID} = process.env
274272

0 commit comments

Comments
 (0)