Skip to content

Commit

Permalink
Implement cosign on docker image (#16774)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaël Goinvic <[email protected]>
  • Loading branch information
gaelgatelement authored Jan 4, 2024
1 parent 25b3ba5 commit 9ee3db1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
permissions:
contents: read
packages: write

id-token: write # needed for signing the images with GitHub OIDC Token
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -29,6 +29,9 @@ jobs:
- name: Inspect builder
run: docker buildx inspect

- name: Install Cosign
uses: sigstore/[email protected]

- name: Checkout repository
uses: actions/checkout@v4

Expand Down Expand Up @@ -68,6 +71,7 @@ jobs:
type=pep440,pattern={{raw}}
- name: Build and push all platforms
id: build-and-push
uses: docker/build-push-action@v5
with:
push: true
Expand All @@ -82,3 +86,14 @@ jobs:
# https://github.com/rust-lang/cargo/issues/10583
build-args: |
CARGO_NET_GIT_FETCH_WITH_CLI=true
- name: Sign the images with GitHub OIDC Token
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
TAGS: ${{ steps.set-tag.outputs.tags }}
run: |
images=""
for tag in ${TAGS}; do
images+="${tag}@${DIGEST} "
done
cosign sign --yes ${images}
1 change: 1 addition & 0 deletions changelog.d/16774.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sign the published docker image using [cosign](https://docs.sigstore.dev/).

0 comments on commit 9ee3db1

Please sign in to comment.