Skip to content

Commit

Permalink
feat(verify): Add option to fail silently
Browse files Browse the repository at this point in the history
Some projects may want to opt to continue their workflow in spite of failure
  • Loading branch information
EyeCantCU committed Jan 3, 2024
1 parent 7c999d1 commit c0e6a7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ jobs:
cert-identity: https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main
oidc-issuer: https://token.actions.githubusercontent.com
```

While not recommended, you may also opt to fail verification silently without disrupting your workflow by setting `fail-silently: 'true'`.
12 changes: 10 additions & 2 deletions verify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ inputs:
containers:
description: 'Names of the target containers to verify'
required: true
fail-silently:
description: 'Fail without exiting.'
default: 'false'
required: false
pubkey:
description: 'Public key used by target container'
default: 'https://raw.githubusercontent.com/ublue-os/main/main/cosign.pub'
Expand All @@ -34,14 +38,18 @@ runs:
for CONTAINER in $(echo "${CONTAINERS}" | tr "," "\n"); do
if ! cosign verify $REGISTRY/${CONTAINER} --certificate-identity=${{ inputs.cert-identity }} --certificate-oidc-issuer=${{ inputs.oidc-issuer }} | jq; then
echo "NOTICE: Verification failed. Please ensure your public key is correct."
exit 1
if [[ "${{ matrix.fail-silently }}" != 'true' ]]; then
exit 1
fi
fi
done
elif [[ -n "${{ inputs.pubkey }}" ]]; then
for CONTAINER in $(echo "${CONTAINERS}" | tr "," "\n"); do
if ! cosign verify --key ${{ inputs.pubkey }} $REGISTRY/${CONTAINER} | jq; then
echo "NOTICE: Verification failed. Please ensure your public key is correct."
exit 1
if [[ "${{ matrix.fail-silently }}" != 'true' ]]; then
exit 1
fi
fi
done
else
Expand Down

0 comments on commit c0e6a7d

Please sign in to comment.