Skip to content

Commit

Permalink
added: cosgin simple and oci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aabouzaid committed Nov 30, 2023
1 parent 3440651 commit bfb99a8
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/sign.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Sign Helm chart artifact

on:
push:
branches:
- dev

jobs:
sign:
name: Sign ${{ matrix.case.name }}
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
case:
- name: TGZ Helm chart artifact
sign: |
cosign sign-blob -y my-app-1.0.0.tgz \
--bundle my-app-1.0.0.tgz.cosign.bundle
verify: |
cosign verify-blob my-app-1.0.0.tgz \
--bundle my-app-1.0.0.tgz.cosign.bundle \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
--certificate-identity "https://github.com/${GITHUB_WORKFLOW_REF}"
- name: OCI Helm chart artifact
sign: |
helm push my-app-1.0.0.tgz oci://ttl.sh/charts &> push-metadata.txt
CHART_DIGEST=$(awk '/Digest: /{print $2}' push-metadata.txt)
echo "CHART_DIGEST=${CHART_DIGEST}" | tee -a $GITHUB_ENV
cosign sign -y "ttl.sh/charts/my-app@${CHART_DIGEST}"
verify: |
cosign verify "ttl.sh/charts/my-app@${CHART_DIGEST}" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
--certificate-identity "https://github.com/${GITHUB_WORKFLOW_REF}"
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Create Helm chart package
run : helm package charts/my-app
- name: Sign Helm chart package
run : ${{ matrix.case.sign }}
- name: Verify Helm chart package
run : ${{ matrix.case.verify }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tgz
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# Cosign Helm chart keyless signing example
An example of using Sigstore/Cosign to secure the Helm chart supply chain. For the full post: [Helm chart keyless signing with Sigstore/Cosign](https://tech.aabouzaid.com/2023/08/helm-chart-keyless-signing-with-sigstore-cosign.html)https://tech.aabouzaid.com/2023/08/helm-chart-keyless-signing-with-sigstore-cosign.html.
An example of using Sigstore/Cosign to secure the Helm chart supply chain.

<div align="center" class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGSVfieFTUOTLbfxF7P06tz9LMdhf0rxoubZxcPUl8qkyTqbrx3lqq3JzjusQQ8hd_aicqy_A33OwkGCv-RgImMUjUjFqUnnit2NgufepKQFuQPOJfg2Z1D7Ta-NP1bgNCgeSK4utJ4CkxlpKE9f1g6Hj5xD8waQPxthh0sh-PlRXH-jmmcdWq030rHlqP/s1200/helm-chart-keyless-signing-with-sigstore-cosign.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="627" data-original-width="1200" height="334" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGSVfieFTUOTLbfxF7P06tz9LMdhf0rxoubZxcPUl8qkyTqbrx3lqq3JzjusQQ8hd_aicqy_A33OwkGCv-RgImMUjUjFqUnnit2NgufepKQFuQPOJfg2Z1D7Ta-NP1bgNCgeSK4utJ4CkxlpKE9f1g6Hj5xD8waQPxthh0sh-PlRXH-jmmcdWq030rHlqP/s1200/helm-chart-keyless-signing-with-sigstore-cosign.png" width="640" /></a>
</div>

- Full blog post: [Helm chart keyless signing with Sigstore/Cosign](https://tech.aabouzaid.com/2023/08/helm-chart-keyless-signing-with-sigstore-cosign.html).

- Full GitHub Actions workflow: [Sign Helm chart artifact](.github/workflows/sign.yaml).
10 changes: 10 additions & 0 deletions charts/my-app/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: my-app
version: 1.0.0
appVersion: 1.0.0
description: A dummy chart for Helm chart keyless signing with Cosign example.
keywords:
- devsecops
- cosign
- helm
- kubernetes
2 changes: 2 additions & 0 deletions push-metadata.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Pushed: ttl.sh/charts/my-app:1.0.0
Digest: sha256:07eadc88303da523e3030a2f4d4fb994dad25284b42842ab0fbbb1aa87df171a

0 comments on commit bfb99a8

Please sign in to comment.