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

fix: fix cosign image signing after breaking changes #1047

Merged
merged 1 commit into from
Mar 16, 2023
Merged
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
19 changes: 14 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
packages: write
id-token: write
env:
IMAGE_TAG: ghcr.io/keptn/${{ matrix.config.name }}:${{ needs.release-please.outputs.tag_name }}
IMAGE_NAME: ghcr.io/keptn/${{ matrix.config.name }}
IMAGE_TAG: ${{ needs.release-please.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -81,13 +82,14 @@ jobs:
uses: sigstore/[email protected]

- name: Build Docker Image
id: docker_build_image
uses: docker/build-push-action@v4
with:
context: ${{ matrix.config.folder }}
platforms: linux/amd64,linux/arm64
target: production
tags: |
${{ env.IMAGE_TAG }}
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
build-args: |
GIT_HASH=${{ env.GIT_SHA }}
RELEASE_VERSION=dev-${{ env.DATETIME }}
Expand All @@ -99,13 +101,20 @@ jobs:
cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }}

- name: Sign container images
run: cosign sign ${{ env.IMAGE_TAG }}
- name: Sign container image
env:
IMAGE_DIGEST: ${{ steps.docker_build_image.outputs.digest }}
run: |
cosign sign --yes ${{ env.IMAGE_NAME }}@${{ env.IMAGE_DIGEST }}
cosign verify \
--certificate-identity-regexp="https://github.com/keptn/lifecycle-toolkit/.*" \
--certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
${{ env.IMAGE_NAME }}@${{ env.IMAGE_DIGEST }}

- name: Generate SBOM
uses: anchore/[email protected]
with:
image: ${{ env.IMAGE_TAG }}
image: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
artifact-name: sbom-${{ matrix.config.name }}
output-file: ./sbom-${{ matrix.config.name }}.spdx.json

Expand Down