Skip to content

Commit

Permalink
Sign images using Sigstore (#3707)
Browse files Browse the repository at this point in the history
* Limit workflow job permissions to bare minimum

This allows to narrow down workflow permissions in GitHub settings

See https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
and https://docs.github.com/en/actions/security-guides/automatic-token-authentication\#permissions-for-the-github_token

Signed-off-by: Marco Franssen <[email protected]>

* Add container signing using Sigstore keyless

Signed-off-by: Marco Franssen <[email protected]>

Signed-off-by: Marco Franssen <[email protected]>
Co-authored-by: Marcos Yacob <[email protected]>
  • Loading branch information
marcofranssen and MarcosDY authored Jan 12, 2023
1 parent 4f5445c commit f9977d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/nightly_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ jobs:

permissions:
contents: read
id-token: write
packages: write

env:
COSIGN_EXPERIMENTAL: 1

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install cosign
uses: sigstore/[email protected]
with:
cosign-release: v1.13.1
- name: Install regctl
uses: regclient/actions/regctl-installer@main
- name: Build images
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,19 @@ jobs:

permissions:
contents: read
id-token: write
packages: write

env:
COSIGN_EXPERIMENTAL: 1

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install cosign
uses: sigstore/[email protected]
with:
cosign-release: v1.13.1
- name: Download archived images
uses: actions/download-artifact@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/scripts/push-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ for img in "${OCI_IMAGES[@]}"; do

regctl image import "${oci_dir}" "${image_variant}-image.tar"
regctl image copy "${oci_dir}" "${image_to_push}"

image_digest="$(jq -r '.manifests[0].digest' "${ROOTDIR}oci/${image_variant}/index.json")"

cosign sign "${registry}/${img}@${image_digest}"
done

0 comments on commit f9977d1

Please sign in to comment.