Skip to content

Commit f86d021

Browse files
matheuscscptuunit
andauthored
Sign chart with cosign (#356)
* feat(ci): sign chart with cosign * doc: add artifacthub notice and details on how to verify the signed artifacts --------- Signed-off-by: Matheus Pimenta <[email protected]> Signed-off-by: Jan Larwig <[email protected]> Co-authored-by: Jan Larwig <[email protected]>
1 parent 3832a76 commit f86d021

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

.github/workflows/release.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ on:
88
jobs:
99
release:
1010
permissions:
11-
contents: write
12-
packages: write
11+
contents: write # for pushing to gh-pages (HTTPS Helm repository)
12+
packages: write # for pushing to GHCR (OCI Helm repository)
13+
id-token: write # for signing with keyless cosign
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout
1617
uses: actions/checkout@v5
1718
with:
1819
fetch-depth: 0
1920

21+
- name: Setup Cosign
22+
uses: sigstore/[email protected]
23+
2024
- name: Configure Git
2125
run: |
2226
git config user.name "$GITHUB_ACTOR"
@@ -42,12 +46,15 @@ jobs:
4246
username: ${{ github.actor }}
4347
password: ${{ secrets.GITHUB_TOKEN }}
4448

45-
- name: Push Charts to GHCR
49+
- name: Push Charts to GHCR and Sign
4650
run: |
4751
shopt -s nullglob
4852
for pkg in .cr-release-packages/*; do
4953
if [ -z "${pkg:-}" ]; then
5054
break
5155
fi
52-
helm push "${pkg}" oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts
56+
chart_name=$(echo "${pkg##*/}" | sed 's/-[0-9].*$//')
57+
repo="oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts"
58+
helm push "${pkg}" "${repo}" |& grep Digest: | awk '{print $NF}' > digest.txt
59+
cosign sign --yes "${repo}/${chart_name}@$(cat digest.txt)"
5360
done

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,24 @@ Linting/validation uses the [helm/chart-testing tool](https://github.com/helm/ch
1818
ct lint --all --config ct.yaml
1919
ct install --all --config ct.yaml
2020
```
21+
22+
## Verify Signed Helm Charts
23+
24+
With the introduction of cosign for signing artifacts you can verify the
25+
integrity of our artifacts using the following command:
26+
27+
```
28+
VERSION=8.2.2
29+
cosign verify --certificate-oidc-issuer https://token.actions.githubusercontent.com \
30+
--certificate-github-workflow-repository oauth2-proxy/manifests \
31+
--certificate-github-workflow-name "Release Charts" \
32+
--certificate-github-workflow-ref main \
33+
--certificate-identity "https://github.com/oauth2-proxy/manifests/.github/workflows/release.yaml@main" \
34+
"oci://ghcr.io/oauth2-proxy/manifests/charts/oauth2-proxy@${VERSION}" | jq
35+
```
36+
37+
Note:
38+
39+
We utilize cosign to sign and verify artifacts with the KEYLESS mode. To learn
40+
more about how keyless signing is done, visit the official documentation about
41+
[Keyless Signatures](https://docs.sigstore.dev/cosign/signing/overview/#the-signing-witnessing-and-verifying-process).

helm/oauth2-proxy/Chart.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: oauth2-proxy
2-
version: 8.2.1
2+
version: 8.2.2
33
apiVersion: v2
44
appVersion: 7.12.0
55
home: https://oauth2-proxy.github.io/oauth2-proxy/
@@ -31,8 +31,8 @@ maintainers:
3131
kubeVersion: ">=1.16.0-0"
3232
annotations:
3333
artifacthub.io/changes: |
34-
- kind: added
35-
description: Add support for new container resize policy feature
34+
- kind: security
35+
description: Adding cosign keyless signing for helm chart artifact
3636
links:
3737
- name: Github PR
38-
url: https://github.com/oauth2-proxy/manifests/pull/346
38+
url: https://github.com/oauth2-proxy/manifests/pull/356

0 commit comments

Comments
 (0)