Skip to content

Commit d9db19d

Browse files
authored
update image signing process (#301)
Signed-off-by: Kent Rancourt <[email protected]>
1 parent 2c14d31 commit d9db19d

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

.github/workflows/release.yaml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ on:
66
- created
77

88
jobs:
9-
build-and-push-image:
9+
10+
publish-image:
1011
permissions:
11-
packages: write # Used to push images to ghcr.io
1212
contents: write # Used to upload assets
13+
packages: write # Used to push images to `ghcr.io`
14+
id-token: write # Needed to create an OIDC token for keyless signing
1315
runs-on: ubuntu-latest
16+
outputs:
17+
image-digest: ${{ steps.image.outputs.digest }}
1418
services:
1519
registry:
1620
image: registry:2
@@ -48,6 +52,7 @@ jobs:
4852
docker push localhost:5000/kargo-render-base:latest-arm64
4953
docker push localhost:5000/kargo-render-base:latest-amd64
5054
- name: Build and push final image
55+
id: image
5156
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0
5257
with:
5358
platforms: linux/amd64,linux/arm64
@@ -60,14 +65,33 @@ jobs:
6065
push: true
6166
cache-from: type=gha
6267
cache-to: type=gha,mode=max
68+
provenance: false
69+
sbom: false
6370
- name: Sign image
64-
env:
65-
TAGS: ${{ steps.meta.outputs.tags }}
66-
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
67-
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
6871
run: |
69-
cosign sign --key env://COSIGN_PRIVATE_KEY ${TAGS}
72+
cosign sign \
73+
-a "repo=${{ github.repository }}" \
74+
-a "workflow=${{ github.workflow }}" \
75+
-a "sha=${{ github.sha }}" \
76+
--yes \
77+
ghcr.io/akuity/kargo-render@${{ steps.image.outputs.digest}}
7078
- name: Publish SBOM
7179
uses: anchore/sbom-action@d94f46e13c6c62f59525ac9a1e147a99dc0b9bf5 # v0.17.0
7280
with:
7381
image: ${{ steps.meta.outputs.tags }}
82+
83+
image-provenance:
84+
needs:
85+
- publish-image
86+
permissions:
87+
actions: read # for detecting the Github Actions environment.
88+
id-token: write # for creating OIDC tokens for signing.
89+
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
90+
# Must be referenced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
91+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
92+
with:
93+
image: ghcr.io/akuity/kargo-render
94+
digest: ${{ needs.publish-image.outputs.image-digest }}
95+
secrets:
96+
registry-username: ${{ github.actor }}
97+
registry-password: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)