From c37c4ed73dc02ae4c53ba51c2543269be08efa25 Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Mon, 3 Aug 2015 16:19:55 -0700 Subject: [PATCH 1/2] Retry uploading/publishing CI builds to work around gsutil bug --- build/push-ci-build.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build/push-ci-build.sh b/build/push-ci-build.sh index 84c3846bd86..8ad063dcb51 100755 --- a/build/push-ci-build.sh +++ b/build/push-ci-build.sh @@ -32,5 +32,11 @@ KUBE_GCS_LATEST_CONTENTS=${LATEST} KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. source "$KUBE_ROOT/build/common.sh" -kube::release::gcs::release -kube::release::gcs::publish_latest +MAX_ATTEMPTS=3 +attempt=0 +while [[ ${attempt} -lt ${MAX_ATTEMPTS} ]]; do + kube::release::gcs::release && kube::release::gcs::publish_latest && break || true + attempt=$((attempt + 1)) + sleep 5 +done +[[ ${attempt} -lt ${MAX_ATTEMPTS} ]] || exit 1 From 1289165aeb5340d8666514f88c4b923ffef5d823 Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Mon, 3 Aug 2015 17:01:50 -0700 Subject: [PATCH 2/2] Add environment variable to delete existing release on GCS --- build/common.sh | 17 ++++++++++------- build/push-ci-build.sh | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build/common.sh b/build/common.sh index 3b7e1ff717e..5f5a64b8031 100755 --- a/build/common.sh +++ b/build/common.sh @@ -43,6 +43,7 @@ readonly KUBE_GCS_RELEASE_PREFIX=${KUBE_GCS_RELEASE_PREFIX-devel}/ readonly KUBE_GCS_DOCKER_REG_PREFIX=${KUBE_GCS_DOCKER_REG_PREFIX-docker-reg}/ readonly KUBE_GCS_LATEST_FILE=${KUBE_GCS_LATEST_FILE:-} readonly KUBE_GCS_LATEST_CONTENTS=${KUBE_GCS_LATEST_CONTENTS:-} +readonly KUBE_GCS_DELETE_EXISTING="${KUBE_GCS_DELETE_EXISTING:-n}" # Constants readonly KUBE_BUILD_IMAGE_REPO=kube-build @@ -908,13 +909,15 @@ function kube::release::gcs::copy_release_artifacts() { # First delete all objects at the destination if gsutil ls "${gcs_destination}" >/dev/null 2>&1; then kube::log::error "${gcs_destination} not empty." - read -p "Delete everything under ${gcs_destination}? [y/n] " -r || { - echo "EOF on prompt. Skipping upload" - return - } - [[ $REPLY =~ ^[yY]$ ]] || { - echo "Skipping upload" - return + [[ ${KUBE_GCS_DELETE_EXISTING} =~ ^[yY]$ ]] || { + read -p "Delete everything under ${gcs_destination}? [y/n] " -r || { + echo "EOF on prompt. Skipping upload" + return + } + [[ $REPLY =~ ^[yY]$ ]] || { + echo "Skipping upload" + return + } } gsutil -q -m rm -f -R "${gcs_destination}" fi diff --git a/build/push-ci-build.sh b/build/push-ci-build.sh index 8ad063dcb51..45c9f930194 100755 --- a/build/push-ci-build.sh +++ b/build/push-ci-build.sh @@ -24,6 +24,7 @@ LATEST=$(git describe) KUBE_GCS_NO_CACHING=n KUBE_GCS_MAKE_PUBLIC=y KUBE_GCS_UPLOAD_RELEASE=y +KUBE_GCS_DELETE_EXISTING=y KUBE_GCS_RELEASE_BUCKET=kubernetes-release KUBE_GCS_RELEASE_PREFIX="ci/${LATEST}" KUBE_GCS_LATEST_FILE="ci/latest.txt"