Skip to content

Commit

Permalink
feat: add image and chart signing (#242)
Browse files Browse the repository at this point in the history
* feat: add image signing

Signed-off-by: Bence Csati <bcsati@cisco.com>

* feat: add chart signing

Signed-off-by: Bence Csati <bcsati@cisco.com>

---------

Signed-off-by: Bence Csati <bcsati@cisco.com>
  • Loading branch information
csatib02 authored Aug 8, 2024
1 parent 3b1afc9 commit 6693a40
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1

- name: Set up Cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0

- name: Set image name
id: image-name
run: echo "value=ghcr.io/${{ github.repository }}" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -114,6 +117,19 @@ jobs:
outputs: ${{ steps.build-output.outputs.value }}
# push: ${{ inputs.publish }}

- name: Sign image with GitHub OIDC Token
if: ${{ inputs.publish && github.repository_owner == 'bank-vaults' }} # Check if the workflow is called by the same GitHub organization
env:
DIGEST: ${{ steps.build.outputs.digest }}
TAGS: ${{ steps.meta.outputs.tags }}
run: |
images=""
for tag in ${TAGS}; do
images+="${tag}@${DIGEST} "
done
cosign sign --yes ${images}
- name: Set image ref
id: image-ref
run: echo "value=${{ steps.image-name.outputs.value }}@${{ steps.build.outputs.digest }}" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -186,6 +202,9 @@ jobs:
with:
version: v3.12.0

- name: Set up Cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0

- name: Set chart name
id: chart-name
run: echo "value=${{ github.event.repository.name }}" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -221,6 +240,13 @@ jobs:
helm package deploy/charts/${{ steps.chart-name.outputs.value }} --version ${{ steps.version.outputs.value }} --app-version ${{ steps.raw-version.outputs.value }}
echo "package=${{ steps.chart-name.outputs.value }}-${{ steps.version.outputs.value }}.tgz" >> "$GITHUB_OUTPUT"
- name: Sign chart with GitHub OIDC Token
if: ${{ inputs.publish && github.repository_owner == 'bank-vaults' }} # Check if the workflow is called by the same GitHub organization
env:
PACKAGE: ${{ steps.build.outputs.package }}
run: |
cosign sign-blob --yes $PACKAGE
- name: Upload chart as artifact
uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
with:
Expand Down

0 comments on commit 6693a40

Please sign in to comment.