-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SLSA3 generators to release workflow
Generate SLSA level 3 provenance attestations for the release assets and for the multi-arch container images. Signed-off-by: Stefan Prodan <[email protected]>
- Loading branch information
1 parent
cf5e7c3
commit bb667a3
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ permissions: | |
|
||
jobs: | ||
release-flux-cli: | ||
outputs: | ||
hashes: ${{ steps.slsa.outputs.hashes }} | ||
image_url: ${{ steps.slsa.outputs.image_url }} | ||
image_digest: ${{ steps.slsa.outputs.image_digest }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # needed to write releases | ||
|
@@ -74,6 +78,7 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run GoReleaser | ||
id: run-goreleaser | ||
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0 | ||
with: | ||
version: latest | ||
|
@@ -82,6 +87,22 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | ||
AUR_BOT_SSH_PRIVATE_KEY: ${{ secrets.AUR_BOT_SSH_PRIVATE_KEY }} | ||
- name: Generate SLSA metadata | ||
id: slsa | ||
env: | ||
ARTIFACTS: "${{ steps.run-goreleaser.outputs.artifacts }}" | ||
run: | | ||
set -euo pipefail | ||
hashes=$(echo $ARTIFACTS | jq --raw-output '.[] | {name, "digest": (.extra.Digest // .extra.Checksum)} | select(.digest) | {digest} + {name} | join(" ") | sub("^sha256:";"")' | base64 -w0) | ||
echo "hashes=$hashes" >> $GITHUB_OUTPUT | ||
image_url=fluxcd/flux-cli:${{ steps.prep.outputs.version }} | ||
echo "image_url=$image_url" >> $GITHUB_OUTPUT | ||
image_digest=$(docker buildx imagetools inspect ${image_url} --format '{{json .}}' | jq -r .manifest.digest) | ||
echo "image_digest=$image_digest" >> $GITHUB_OUTPUT | ||
release-flux-manifests: | ||
runs-on: ubuntu-latest | ||
needs: release-flux-cli | ||
|
@@ -148,3 +169,43 @@ jobs: | |
flux tag artifact oci://docker.io/fluxcd/flux-manifests:${{ steps.prep.outputs.version }} \ | ||
--tag latest | ||
release-provenance: | ||
needs: [release-flux-cli] | ||
permissions: | ||
actions: read # for detecting the Github Actions environment. | ||
id-token: write # for creating OIDC tokens for signing. | ||
contents: write # for uploading attestations to GitHub releases. | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | ||
with: | ||
provenance-name: "provenance.intoto.jsonl" | ||
base64-subjects: "${{ needs.release-flux-cli.outputs.hashes }}" | ||
upload-assets: true | ||
|
||
dockerhub-provenance: | ||
needs: [release-flux-cli] | ||
permissions: | ||
actions: read # for detecting the Github Actions environment. | ||
id-token: write # for creating OIDC tokens for signing. | ||
packages: write # for uploading attestations. | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | ||
with: | ||
image: ${{ needs.release-flux-cli.outputs.image_url }} | ||
digest: ${{ needs.release-flux-cli.outputs.image_digest }} | ||
registry-username: fluxcdbot | ||
secrets: | ||
registry-password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} | ||
|
||
ghcr-provenance: | ||
needs: [release-flux-cli] | ||
permissions: | ||
actions: read # for detecting the Github Actions environment. | ||
id-token: write # for creating OIDC tokens for signing. | ||
packages: write # for uploading attestations. | ||
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | ||
with: | ||
image: ghcr.io/${{ needs.release-flux-cli.outputs.image_url }} | ||
digest: ${{ needs.release-flux-cli.outputs.image_digest }} | ||
registry-username: fluxcdbot | ||
secrets: | ||
registry-password: ${{ secrets.GHCR_TOKEN }} |