Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign images using Sigstore #3707

Merged
merged 7 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +20 to +21
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this to use keyless approach?

Copy link
Contributor Author

@marcofranssen marcofranssen Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, although experimental, haven't faced any issue in the last year I have been using it on various repos. I think they are close to making this feature GA, so with new release of cosign, this might not be required anymore.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigstore is now GA so the env var here is no longer needed 🎉

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still required until we cut a cosign release v2


steps:
- name: Checkout
uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a good practice is to use the git hash instead of the tag and have a comment to which release is pointing to. Dependabot when update the release can also update the comment :)

Suggested change
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

same applies to the other actions

Copy link
Contributor Author

@marcofranssen marcofranssen Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another PR adressing this practice already. #3727

- name: Install cosign
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, we'll be signing only release and nightly builds, how about regular builds images? (the ones generated when running PRs)
I think signing regular PR images can be useful to verify sign still working, and we may benefits with that if we create an IT that verify our images are signed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, you can sign the image that you generate in the main branch build

Copy link
Contributor Author

@marcofranssen marcofranssen Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that there is already a nightly in place. On the main branch no images are released, so also nothing to sign there. Or is there a way to sign an image that hasn't been pushed to a registry? Basically offline signature? I'm not aware you can sign without pushing to a registry.

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
marcofranssen marked this conversation as resolved.
Show resolved Hide resolved

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