From 3d108d0e7824741b2aae66da4d83099eb007cc14 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Mon, 18 Sep 2023 14:49:34 -0700 Subject: [PATCH] update: pr comments Signed-off-by: Brian Downs --- bin/rancher_image_chart_promote.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) mode change 100644 => 100755 bin/rancher_image_chart_promote.sh diff --git a/bin/rancher_image_chart_promote.sh b/bin/rancher_image_chart_promote.sh old mode 100644 new mode 100755 index 317ce413..31912cd8 --- a/bin/rancher_image_chart_promote.sh +++ b/bin/rancher_image_chart_promote.sh @@ -59,9 +59,8 @@ until [ ${PAGE} -gt 100 ]; do echo "finding build number for tag: ${SOURCE_TAG}" BUILD_NUMBER=$(drone build ls rancher/rancher --page ${PAGE} --event tag --format "{{.Number}},{{.Ref}}"| grep "${SOURCE_TAG}"$ |cut -d',' -f1|head -1) - if [ ! -n "${BUILD_NUMBER}" ]; then - echo "error: no build found for tag: ${SOURCE_TAG}" - exit 1 + if [ -n "${BUILD_NUMBER}" ]; then + break fi PAGE=$((PAGE+1)) @@ -69,6 +68,11 @@ until [ ${PAGE} -gt 100 ]; do sleep 1 done +if [ ! -n "${BUILD_NUMBER}" ]; then + echo "error: no build found for tag: ${SOURCE_TAG}" + exit 1 +fi + echo "Found build number ${BUILD_NUMBER} for tag ${SOURCE_TAG}" if [ "${DRY_RUN}" = true ]; then CMD="drone build promote rancher/rancher ${BUILD_NUMBER} promote-docker-image --param=SOURCE_TAG=${SOURCE_TAG} --param=DESTINATION_TAG=${DESTINATION_TAG}" @@ -76,6 +80,7 @@ if [ "${DRY_RUN}" = true ]; then else drone build promote rancher/rancher "${BUILD_NUMBER} promote-docker-image --param=SOURCE_TAG=${SOURCE_TAG} --param=DESTINATION_TAG=${DESTINATION_TAG}" BUILD_NUMBER="" + sleep 2 fi echo "promoting Chart${SOURCE_TAG} to ${DESTINATION_TAG}"