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 2 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
7 changes: 4 additions & 3 deletions .github/workflows/depsreview.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/nightly_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,29 @@ on:
# Random minute number to avoid GH scheduler stampede
- cron: '37 21 * * *'
workflow_dispatch: {}
permissions:
contents: read
packages: write

env:
NIGHTLY: true

jobs:
build-and-publish-images:
runs-on: ubuntu-20.04

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: Build images
run: make images scratch-images
- name: Log in to GCR
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/pr_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
cache-deps:
name: cache-deps (linux)
runs-on: ubuntu-20.04

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -30,6 +34,10 @@ jobs:
name: lint (linux)
runs-on: ubuntu-20.04
needs: cache-deps

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -64,6 +72,10 @@ jobs:
OS: [ubuntu-20.04, macos-latest]
runs-on: ${{ matrix.OS }}
needs: cache-deps

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -83,6 +95,10 @@ jobs:
name: unit-test (linux with race detection)
runs-on: ubuntu-20.04
needs: cache-deps

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -102,6 +118,10 @@ jobs:
name: artifacts (linux)
runs-on: ubuntu-20.04
needs: [cache-deps]

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -133,6 +153,10 @@ jobs:
name: images (linux)
runs-on: ubuntu-20.04
needs: [cache-deps]

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -166,6 +190,10 @@ jobs:
name: images (windows)
runs-on: windows-2022
needs: artifact-windows

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -189,6 +217,10 @@ jobs:
scratch-images:
runs-on: ubuntu-20.04
needs: [cache-deps]

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -222,6 +254,10 @@ jobs:
name: integration (linux)
runs-on: ubuntu-20.04
needs: [cache-deps, images, scratch-images]

permissions:
contents: read

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -278,6 +314,10 @@ jobs:
name: integration (windows)
runs-on: windows-2022
needs: images-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -325,6 +365,10 @@ jobs:
cache-deps-windows:
name: cache-deps (windows)
runs-on: windows-2022

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -344,6 +388,10 @@ jobs:
name: lint (windows)
runs-on: windows-2022
needs: cache-deps-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -387,6 +435,10 @@ jobs:
name: unit-test (windows)
runs-on: windows-2022
needs: cache-deps-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -419,6 +471,10 @@ jobs:
name: artifact (windows)
runs-on: windows-2022
needs: cache-deps-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/release_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
cache-deps:
name: cache-deps (linux)
runs-on: ubuntu-20.04

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -28,6 +32,10 @@ jobs:
name: lint (linux)
runs-on: ubuntu-20.04
needs: cache-deps

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -62,6 +70,10 @@ jobs:
OS: [ubuntu-20.04, macos-latest]
runs-on: ${{ matrix.OS }}
needs: cache-deps

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -81,6 +93,10 @@ jobs:
name: unit-test (linux with race detection)
runs-on: ubuntu-20.04
needs: cache-deps

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -100,6 +116,10 @@ jobs:
name: artifacts (linux)
runs-on: ubuntu-20.04
needs: [cache-deps]

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -131,6 +151,10 @@ jobs:
name: images (linux)
runs-on: ubuntu-20.04
needs: [cache-deps]

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -164,6 +188,10 @@ jobs:
name: images (windows)
runs-on: windows-2022
needs: artifact-windows

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -187,6 +215,10 @@ jobs:
scratch-images:
runs-on: ubuntu-20.04
needs: [cache-deps]

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -220,6 +252,10 @@ jobs:
name: integration (linux)
runs-on: ubuntu-20.04
needs: [cache-deps, images, scratch-images]

permissions:
contents: read

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -287,6 +323,10 @@ jobs:
name: integration (windows)
runs-on: windows-2022
needs: images-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -334,6 +374,10 @@ jobs:
cache-deps-windows:
name: cache-deps (windows)
runs-on: windows-2022

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -353,6 +397,10 @@ jobs:
name: lint (windows)
runs-on: windows-2022
needs: cache-deps-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -396,6 +444,10 @@ jobs:
name: unit-test (windows)
runs-on: windows-2022
needs: cache-deps-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -428,6 +480,10 @@ jobs:
name: artifact (windows)
runs-on: windows-2022
needs: cache-deps-windows

permissions:
contents: read

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -478,6 +534,10 @@ jobs:
runs-on: ubuntu-20.04
needs: [lint, unit-test, unit-test-race-detector, artifacts, integration,
lint-windows, unit-test-windows, artifact-windows, integration-windows]

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -501,9 +561,22 @@ jobs:
publish-images:
runs-on: ubuntu-20.04
needs: [lint, unit-test, unit-test-race-detector, artifacts, integration]

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
Loading