From 93592de3ed7ea7e2f85f1b9dd4bd3f60b73da3e4 Mon Sep 17 00:00:00 2001 From: Celeste Zeng <61256376+celeste-zeng@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:41:22 -0700 Subject: [PATCH 1/7] Update publish_docker_images.sh to retag multi-arch image --- .../src/main/scripts/publish_docker_images.sh | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/release/src/main/scripts/publish_docker_images.sh b/release/src/main/scripts/publish_docker_images.sh index d7c1d1b9599e..d1e449775d09 100755 --- a/release/src/main/scripts/publish_docker_images.sh +++ b/release/src/main/scripts/publish_docker_images.sh @@ -37,34 +37,22 @@ echo "Which release candidate will be the source of final docker images? (ex: 1) read RC_NUM RC_VERSION="rc${RC_NUM}" -echo "================Pull RC Containers from DockerHub===========" -IMAGES=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --format "{{.Name}}" --limit 100) -KNOWN_IMAGES=() -echo "We are using ${RC_VERSION} to push docker images for ${RELEASE}." -while read IMAGE; do - # Try pull verified RC from dockerhub. - if docker pull "${IMAGE}:${RELEASE}${RC_VERSION}" 2>/dev/null ; then - KNOWN_IMAGES+=( $IMAGE ) - fi -done < <(echo "${IMAGES}") - echo "================Confirming Release and RC version===========" +IMAGES_ALL=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --format "{{.Name}}" --limit 100) echo "Publishing the following images:" # Sort by name for easy examination -IFS=$'\n' KNOWN_IMAGES=($(sort <<<"${KNOWN_IMAGES[*]}")) +IFS=$'\n' IMAGES=($(sort <<<"${IMAGES_ALL[*]}")) unset IFS -printf "%s\n" ${KNOWN_IMAGES[@]} +printf "%s\n" ${IMAGES[@]} echo "Do you want to proceed? [y|N]" read confirmation if [[ $confirmation = "y" ]]; then - for IMAGE in "${KNOWN_IMAGES[@]}"; do - # Tag with ${RELEASE} and push to dockerhub. - docker tag "${IMAGE}:${RELEASE}${RC_VERSION}" "${IMAGE}:${RELEASE}" - docker push "${IMAGE}:${RELEASE}" + for IMAGE in "${IMAGES[@]}"; do + # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as ${RELEASE}". + docker buildx imagetools create --tag' "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" - # Tag with latest and push to dockerhub. - docker tag "${IMAGE}:${RELEASE}${RC_VERSION}" "${IMAGE}:latest" - docker push "${IMAGE}:latest" + # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as latest". + docker buildx imagetools create "${IMAGE}:latest" "${IMAGE}:${RELEASE}${RC_VERSION}" done fi From 2797abf570824a49579711cfdec798174d9b57f5 Mon Sep 17 00:00:00 2001 From: Celeste Zeng <61256376+celeste-zeng@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:48:00 -0700 Subject: [PATCH 2/7] add --tag --- release/src/main/scripts/publish_docker_images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/src/main/scripts/publish_docker_images.sh b/release/src/main/scripts/publish_docker_images.sh index d1e449775d09..1a317d63124d 100755 --- a/release/src/main/scripts/publish_docker_images.sh +++ b/release/src/main/scripts/publish_docker_images.sh @@ -52,7 +52,7 @@ if [[ $confirmation = "y" ]]; then docker buildx imagetools create --tag' "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as latest". - docker buildx imagetools create "${IMAGE}:latest" "${IMAGE}:${RELEASE}${RC_VERSION}" + docker buildx imagetools create --tag "${IMAGE}:latest" "${IMAGE}:${RELEASE}${RC_VERSION}" done fi From edbb30f50ff8992a1981fc62c4a6caa5371dcac5 Mon Sep 17 00:00:00 2001 From: Celeste Zeng <61256376+celeste-zeng@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:04:32 -0700 Subject: [PATCH 3/7] Revert some changes --- .../src/main/scripts/publish_docker_images.sh | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/release/src/main/scripts/publish_docker_images.sh b/release/src/main/scripts/publish_docker_images.sh index 1a317d63124d..b20dd711aa04 100755 --- a/release/src/main/scripts/publish_docker_images.sh +++ b/release/src/main/scripts/publish_docker_images.sh @@ -37,19 +37,29 @@ echo "Which release candidate will be the source of final docker images? (ex: 1) read RC_NUM RC_VERSION="rc${RC_NUM}" +echo "================Pull RC Containers from DockerHub===========" +IMAGES=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --format "{{.Name}}" --limit 100) +KNOWN_IMAGES=() +echo "We are using ${RC_VERSION} to push docker images for ${RELEASE}." +while read IMAGE; do + # Try pull verified RC from dockerhub. + if docker pull "${IMAGE}:${RELEASE}${RC_VERSION}" 2>/dev/null ; then + KNOWN_IMAGES+=( $IMAGE ) + fi +done < <(echo "${IMAGES}") + echo "================Confirming Release and RC version===========" -IMAGES_ALL=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --format "{{.Name}}" --limit 100) echo "Publishing the following images:" # Sort by name for easy examination -IFS=$'\n' IMAGES=($(sort <<<"${IMAGES_ALL[*]}")) +IFS=$'\n' KNOWN_IMAGES=($(sort <<<"${KNOWN_IMAGES[*]}")) unset IFS -printf "%s\n" ${IMAGES[@]} +printf "%s\n" ${KNOWN_IMAGES[@]} echo "Do you want to proceed? [y|N]" read confirmation if [[ $confirmation = "y" ]]; then - for IMAGE in "${IMAGES[@]}"; do + for IMAGE in "${KNOWN_IMAGES[@]}"; do # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as ${RELEASE}". - docker buildx imagetools create --tag' "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" + docker buildx imagetools create --tag "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as latest". docker buildx imagetools create --tag "${IMAGE}:latest" "${IMAGE}:${RELEASE}${RC_VERSION}" From c4de67f9530a2ec863c8e7da4f377bf743867901 Mon Sep 17 00:00:00 2001 From: Celeste Zeng <61256376+celeste-zeng@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:10:13 -0700 Subject: [PATCH 4/7] Try to avoid pulling --- .../src/main/scripts/publish_docker_images.sh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/release/src/main/scripts/publish_docker_images.sh b/release/src/main/scripts/publish_docker_images.sh index b20dd711aa04..0f208069890a 100755 --- a/release/src/main/scripts/publish_docker_images.sh +++ b/release/src/main/scripts/publish_docker_images.sh @@ -37,27 +37,17 @@ echo "Which release candidate will be the source of final docker images? (ex: 1) read RC_NUM RC_VERSION="rc${RC_NUM}" -echo "================Pull RC Containers from DockerHub===========" -IMAGES=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --format "{{.Name}}" --limit 100) -KNOWN_IMAGES=() -echo "We are using ${RC_VERSION} to push docker images for ${RELEASE}." -while read IMAGE; do - # Try pull verified RC from dockerhub. - if docker pull "${IMAGE}:${RELEASE}${RC_VERSION}" 2>/dev/null ; then - KNOWN_IMAGES+=( $IMAGE ) - fi -done < <(echo "${IMAGES}") - echo "================Confirming Release and RC version===========" +ALL_IMAGES=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --filter tag=${RELEASE}${RC_VERSION} --format "{{.Name}}" --limit 100) echo "Publishing the following images:" # Sort by name for easy examination -IFS=$'\n' KNOWN_IMAGES=($(sort <<<"${KNOWN_IMAGES[*]}")) +IFS=$'\n' ALL_IMAGES=($(sort <<<"${ALL_IMAGES[*]}")) unset IFS -printf "%s\n" ${KNOWN_IMAGES[@]} +printf "%s\n" ${ALL_IMAGES[@]} echo "Do you want to proceed? [y|N]" read confirmation if [[ $confirmation = "y" ]]; then - for IMAGE in "${KNOWN_IMAGES[@]}"; do + for IMAGE in "${ALL_IMAGES[@]}"; do # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as ${RELEASE}". docker buildx imagetools create --tag "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" From 0b7662b61e0dd91e7a2eaa2bbf68aa881bc7e636 Mon Sep 17 00:00:00 2001 From: Celeste Zeng <61256376+celeste-zeng@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:18:15 -0700 Subject: [PATCH 5/7] Revert changes --- .../src/main/scripts/publish_docker_images.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/release/src/main/scripts/publish_docker_images.sh b/release/src/main/scripts/publish_docker_images.sh index 0f208069890a..1556346fb4c8 100755 --- a/release/src/main/scripts/publish_docker_images.sh +++ b/release/src/main/scripts/publish_docker_images.sh @@ -37,17 +37,27 @@ echo "Which release candidate will be the source of final docker images? (ex: 1) read RC_NUM RC_VERSION="rc${RC_NUM}" +echo "================Pull RC Containers from DockerHub===========" +IMAGES=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --format "{{.Name}}" --limit 100) +KNOWN_IMAGES=() +echo "We are using ${RC_VERSION} to push docker images for ${RELEASE}." +while read IMAGE; do + # Try pull verified RC from dockerhub. + if docker pull "${IMAGE}:${RELEASE}${RC_VERSION}" 2>/dev/null ; then + KNOWN_IMAGES+=( $IMAGE ) + fi +done < <(echo "${IMAGES}") + echo "================Confirming Release and RC version===========" -ALL_IMAGES=$(docker search ${DOCKER_IMAGE_DEFAULT_REPO_ROOT}/${DOCKER_IMAGE_DEFAULT_REPO_PREFIX} --filter tag=${RELEASE}${RC_VERSION} --format "{{.Name}}" --limit 100) echo "Publishing the following images:" # Sort by name for easy examination -IFS=$'\n' ALL_IMAGES=($(sort <<<"${ALL_IMAGES[*]}")) +IFS=$'\n' KNOWN_IMAGES=($(sort <<<"${KNOWN_IMAGES[*]}")) unset IFS -printf "%s\n" ${ALL_IMAGES[@]} +printf "%s\n" ${KNOWN_IMAGES[@]} echo "Do you want to proceed? [y|N]" read confirmation if [[ $confirmation = "y" ]]; then - for IMAGE in "${ALL_IMAGES[@]}"; do + for IMAGE in "${KNOWN_IMAGES[@]}"; do # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as ${RELEASE}". docker buildx imagetools create --tag "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" From 14cf3db4062a8efa6f6996b2ffc6ce0676a4d8dc Mon Sep 17 00:00:00 2001 From: Celeste Zeng <61256376+celeste-zeng@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:24:09 -0700 Subject: [PATCH 6/7] change source for second command --- release/src/main/scripts/publish_docker_images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/src/main/scripts/publish_docker_images.sh b/release/src/main/scripts/publish_docker_images.sh index 1556346fb4c8..2de16c06b7dc 100755 --- a/release/src/main/scripts/publish_docker_images.sh +++ b/release/src/main/scripts/publish_docker_images.sh @@ -62,7 +62,7 @@ if [[ $confirmation = "y" ]]; then docker buildx imagetools create --tag "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as latest". - docker buildx imagetools create --tag "${IMAGE}:latest" "${IMAGE}:${RELEASE}${RC_VERSION}" + docker buildx imagetools create --tag "${IMAGE}:latest" "${IMAGE}:${RELEASE}" done fi From 5ff934cd8c47ce45e8281d347fbb68793bfece3b Mon Sep 17 00:00:00 2001 From: Celeste Zeng <61256376+celeste-zeng@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:44:09 -0700 Subject: [PATCH 7/7] Adjust comment typo --- release/src/main/scripts/publish_docker_images.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/src/main/scripts/publish_docker_images.sh b/release/src/main/scripts/publish_docker_images.sh index 2de16c06b7dc..b191b7656fa8 100755 --- a/release/src/main/scripts/publish_docker_images.sh +++ b/release/src/main/scripts/publish_docker_images.sh @@ -58,10 +58,10 @@ echo "Do you want to proceed? [y|N]" read confirmation if [[ $confirmation = "y" ]]; then for IMAGE in "${KNOWN_IMAGES[@]}"; do - # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as ${RELEASE}". + # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as ${RELEASE}. docker buildx imagetools create --tag "${IMAGE}:${RELEASE}" "${IMAGE}:${RELEASE}${RC_VERSION}" - # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as latest". + # Perform a carbon copy of ${RC_VERSION} to dockerhub with a new tag as latest. docker buildx imagetools create --tag "${IMAGE}:latest" "${IMAGE}:${RELEASE}" done