Skip to content

Commit

Permalink
chore: update workflow docker publish
Browse files Browse the repository at this point in the history
- enable cosign
  • Loading branch information
mrnabilnoh committed Feb 7, 2023
1 parent 0fc6f32 commit e56f8e4
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ jobs:

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
# - name: Install Cosign
# uses: sigstore/cosign-installer@main
# - name: Check install!
# run: cosign version
- name: Install Cosign
uses: sigstore/cosign-installer@main

- name: Check Cosign Version
run: cosign version

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down Expand Up @@ -83,6 +84,15 @@ jobs:
# build-args: use for overwrite ARG value inside Dockerfile
build-args: |
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
env:
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: |
echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --key env://COSIGN_PRIVATE_KEY -a "repo=${{ github.repository }}" -a "workflow=#${{ github.run_number }}" {}@${{ steps.build-and-push.outputs.digest }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
Expand All @@ -94,17 +104,4 @@ jobs:
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "trivy-results.sarif"

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
sarif_file: "trivy-results.sarif"

0 comments on commit e56f8e4

Please sign in to comment.