From 2d0a4d91fe6a71f3677f45b906ada759063ce754 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 13 Aug 2024 08:46:36 +0200 Subject: [PATCH] Only try to get image manifest digest after pushing Since we anyways can only sign an image which has a manifest digiest --- builder.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/builder.sh b/builder.sh index e48d2a9..e5efe61 100755 --- a/builder.sh +++ b/builder.sh @@ -386,11 +386,13 @@ function run_build() { fi done done - fi - # Singing image (cosign) - image_id=$(docker inspect --format='{{index .RepoDigests 0}}' "${repository}/${image}:${version}") - cosign_sign "${image_id}" + # Singing image (cosign) + if bashio::var.true "${COSIGN}"; then + image_digest=$(docker inspect --format='{{index .RepoDigests 0}}' "${repository}/${image}:${version}") + cosign_sign "${image_digest}" + fi + fi } function convert_to_json() { @@ -757,10 +759,6 @@ function cosign_sign() { local success=false - if bashio::var.false "${DOCKER_PUSH}" || bashio::var.false "${COSIGN}"; then - return 0 - fi - for j in {1..6}; do if cosign sign --yes "${image}"; then success=true