From bf8a6d31dd842c65b831ca7688db883fdb486ce8 Mon Sep 17 00:00:00 2001 From: Neil King Date: Wed, 4 Dec 2024 10:57:37 -0800 Subject: [PATCH] CNJR-4327: Fix Promote - Don't save the docker image on promote. --- bin/build_utils | 8 ++++++-- bin/publish | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/build_utils b/bin/build_utils index 11e2b16a..aee8b22e 100644 --- a/bin/build_utils +++ b/bin/build_utils @@ -35,10 +35,14 @@ function tag_and_push() { shift local target="$1" shift + local promote="${1:-false}" docker tag "${source}" "${target}" - # Save the docker image for artifact signing - docker save -o "docker-image-${source}".tar "${source}" + # Save the docker image for artifact signing unless this is a promote + if [ "$promote" = false ]; then + echo "saving docker image: docker-image-${source}.tar in $(pwd)" + docker save -o "docker-image-${source}.tar" "${source}" + fi docker push "${target}" } diff --git a/bin/publish b/bin/publish index ce7b2ad1..102dd19a 100755 --- a/bin/publish +++ b/bin/publish @@ -118,8 +118,8 @@ if [[ ${PROMOTE} = true ]]; then # Publish images to docker hub for tag in "${TAGS[@]}" $(gen_versions "$REMOTE_TAG"); do echo "Tagging and pushing $REGISTRY/$IMAGE_NAME:$tag" - tag_and_push "${LOCAL_REGISTRY}/$IMAGE_NAME:$SOURCE_TAG" "$REGISTRY/$IMAGE_NAME:$tag" - tag_and_push "${LOCAL_REGISTRY}/${REDHAT_LOCAL_IMAGE}:${SOURCE_TAG}" "$REGISTRY/${REDHAT_LOCAL_IMAGE}:$tag" + tag_and_push "${LOCAL_REGISTRY}/$IMAGE_NAME:$SOURCE_TAG" "$REGISTRY/$IMAGE_NAME:$tag" "${PROMOTE}" + tag_and_push "${LOCAL_REGISTRY}/${REDHAT_LOCAL_IMAGE}:${SOURCE_TAG}" "$REGISTRY/${REDHAT_LOCAL_IMAGE}:$tag" "${PROMOTE}" done