Skip to content

ci: first cut on signing images with Cosign #4483

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

Merged
merged 1 commit into from
Jan 10, 2025
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
16 changes: 16 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
packages: write # for docker/build-push-action to push images
id-token: write # for Cosign to be able to sign images with GHA token
strategy:
matrix:
docker-image:
Expand All @@ -99,6 +100,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0
id: build
with:
context: .
file: ${{ matrix.docker-image }}.dockerfile
Expand All @@ -111,6 +113,20 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Install cosign
if: ${{ github.event_name != 'pull_request' && github.repository == 'weaveworks/weave-gitops' }}
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- name: Keyless signing of image
if: ${{ github.event_name != 'pull_request' && github.repository == 'weaveworks/weave-gitops' }}
run: |
echo ${{ steps.build.outputs.digest }}
cosign sign --yes --rekor-url "https://rekor.sigstore.dev/" ${{ steps.digest.outputs.digest }}
- name: Verify the image signing
if: ${{ github.event_name != 'pull_request' && github.repository == 'weaveworks/weave-gitops' }}
run: |
cosign verify --rekor-url "https://rekor.sigstore.dev/" ${{ steps.digest.outputs.digest }}
--certificate-identity "https://github.com/${{ github.workflow_ref }}"
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" | jq .

ci-upload-binary:
name: Upload Binary - Disabled
Expand Down
Loading