From baf72010889417684e8026031aaaf823d836c6a6 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Fri, 7 Jun 2024 11:10:25 +0200 Subject: [PATCH] scripts: Fix edge case in build-debian-packages-dependencies.sh Make sure the OTHER_SHA truly exists. Sometimes is possible that the only architecture of the image we are considering is the one we are considering. --- .../ci/build-debian-packages-dependencies.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/ci/build-debian-packages-dependencies.sh b/scripts/ci/build-debian-packages-dependencies.sh index 13e8c4316246..0c3dc319c26f 100755 --- a/scripts/ci/build-debian-packages-dependencies.sh +++ b/scripts/ci/build-debian-packages-dependencies.sh @@ -57,12 +57,18 @@ else # we get the sha of the image of the "other" architecture OTHER_SHA=$(docker manifest inspect "${DEP_IMAGE}:$LATEST_TAG" | jq -r ".manifests[] | select(.platform.architecture != \"$ARCHITECTURE\") | .digest" | head -n1) - # we create a new manifest ( override the old one ) with both the - # local image and the image that was in the old manifest - docker buildx imagetools create \ - -t "${DEP_IMAGE}:$LATEST_TAG" \ - "$LOCAL_IMAGE_NAME" \ - "$DEP_IMAGE@$OTHER_SHA" + if [ "${OTHER_SHA}" != "" ]; then + # we create a new manifest ( override the old one ) with both the + # local image and the image that was in the old manifest + docker buildx imagetools create \ + -t "${DEP_IMAGE}:$LATEST_TAG" \ + "$LOCAL_IMAGE_NAME" \ + "$DEP_IMAGE@$OTHER_SHA" + else + # we associate to "$DEP_IMAGE:$LATEST_TAG" the latest image with tag + # "$LOCAL_IMAGE_NAME" and replace the old one. + docker buildx imagetools create -t "$DEP_IMAGE:$LATEST_TAG" "$LOCAL_IMAGE_NAME" + fi fi docker buildx imagetools inspect "${DEP_IMAGE}:${LATEST_TAG}" -- GitLab