From 5f5639da1ea8fc8e5cb821849b61bb3f5305a1b8 Mon Sep 17 00:00:00 2001 From: Joe Finney Date: Wed, 6 Apr 2016 16:42:14 -0700 Subject: [PATCH] Retry the cloudsdk gsutil copy. --- hack/jenkins/e2e-runner.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hack/jenkins/e2e-runner.sh b/hack/jenkins/e2e-runner.sh index 04f52780be0..08ad28015e8 100755 --- a/hack/jenkins/e2e-runner.sh +++ b/hack/jenkins/e2e-runner.sh @@ -248,7 +248,14 @@ fi # Install gcloud from a custom path if provided. Used to test GKE with gcloud # at HEAD, release candidate. if [[ -n "${CLOUDSDK_BUCKET:-}" ]]; then - gsutil -mq cp -r "${CLOUDSDK_BUCKET}" ~ + # Retry the download a few times to mitigate transient server errors and + # race conditions where the bucket contents change under us as we download. + for n in $(seq 3); do + gsutil -mq cp -r "${CLOUDSDK_BUCKET}" ~ && break || sleep 1 + # Delete any temporary files from the download so that we start from + # scratch when we retry. + rm -rf ~/.gsutil + done rm -rf ~/repo ~/cloudsdk mv ~/$(basename "${CLOUDSDK_BUCKET}") ~/repo mkdir ~/cloudsdk