Skip to content

Commit 238f3d4

Browse files
authored
Merge pull request #1963 from GoogleContainerTools/no-resign
skip signing/sbom if already present
2 parents 24c8e13 + 3c0167c commit 238f3d4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

private/oci/sign_and_push.bzl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ tag="$(stamp "{TAG}")"
1111
digest="$(cat {DIGEST})"
1212
echo "Pushing $repository@$digest"
1313
{CRANE} push {IMAGE} "$repository@$digest"
14-
{COSIGN} attest "$repository@$digest" --predicate "{SBOM}" --type "spdx" --yes
15-
{COSIGN} sign "$repository@$digest" --yes
14+
15+
# Check for signature and skip signing/sbom if present
16+
if ! {COSIGN} verify "$repository@$digest" --certificate-oidc-issuer https://accounts.google.com --certificate-identity "${{KEYLESS}}" > /dev/null; then
17+
{COSIGN} attest "$repository@$digest" --predicate "{SBOM}" --type "spdx" --yes
18+
{COSIGN} sign "$repository@$digest" --yes
19+
fi
20+
1621
{CRANE} tag "$repository@$digest" "$tag"
1722
"""
1823

0 commit comments

Comments
 (0)