Skip to content

Commit f0ad295

Browse files
authored
fix: use if/else in attestation assertion step instead of exit $?
1 parent 92b26ee commit f0ad295

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

.github/workflows/__test-workflow-docker-build-images-attestation.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,17 @@ jobs:
137137
gh attestation verify \
138138
oci://ghcr.io/hoverkraft-tech/ci-github-container/"${IMAGE_NAME}" \
139139
--repo hoverkraft-tech/ci-github-container
140-
exit $?
141-
fi
142-
143-
echo "Image ${IMAGE_NAME} should not have an attestation"
144-
if gh attestation verify \
145-
oci://ghcr.io/hoverkraft-tech/ci-github-container/"${IMAGE_NAME}" \
146-
--repo hoverkraft-tech/ci-github-container; then
147-
echo "::error::Image ${IMAGE_NAME} should not be attested but attestation verification succeeded"
148-
exit 1
140+
else
141+
echo "Image ${IMAGE_NAME} should not have an attestation"
142+
if gh attestation verify \
143+
oci://ghcr.io/hoverkraft-tech/ci-github-container/"${IMAGE_NAME}" \
144+
--repo hoverkraft-tech/ci-github-container; then
145+
echo "::error::Image ${IMAGE_NAME} should not be attested but attestation verification succeeded"
146+
exit 1
147+
fi
148+
echo "Attestation verification failed as expected for non-attested image ${IMAGE_NAME}"
149149
fi
150150
151-
echo "Attestation verification failed as expected for non-attested image ${IMAGE_NAME}"
152-
153151
cleanup:
154152
name: Cleanup ephemeral test packages
155153
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)