From 6c9b2bdffc33f3c25a075abe9b3661ed2236252e Mon Sep 17 00:00:00 2001 From: Artyom Lukianov Date: Sun, 10 Mar 2019 14:34:28 +0200 Subject: [PATCH] Repeat bazel build to be sure that it succeeds --- Makefile | 4 ++++ automation/test.sh | 37 ++++++++++++++++++++++++++++-------- hack/bazel-build-images.sh | 39 ++++++++++++++++++++++++++++++++++++++ hack/bazel-push-images.sh | 2 +- 4 files changed, 73 insertions(+), 9 deletions(-) create mode 100755 hack/bazel-build-images.sh diff --git a/Makefile b/Makefile index 671bc8829f34..862fef334070 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,9 @@ bazel-build: --workspace_status_command=./hack/print-workspace-status.sh \ //cmd/..." +bazel-build-images: + hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} ./hack/bazel-build-images.sh" + bazel-push-images: hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} ./hack/bazel-push-images.sh" @@ -113,6 +116,7 @@ builder-publish: .PHONY: \ bazel-generate \ bazel-build \ + bazel-build-images \ bazel-push-images \ bazel-tests \ build \ diff --git a/automation/test.sh b/automation/test.sh index ae7675c8623a..85cff2d9939c 100755 --- a/automation/test.sh +++ b/automation/test.sh @@ -90,8 +90,16 @@ safe_download() ( local remote_sha1_url="${download_from}.sha1" local local_sha1_file="${download_to}.sha1" local remote_sha1 + local retry=3 # Remote file includes only sha1 w/o filename suffix - remote_sha1="$(curl -s "${remote_sha1_url}")" + for i in $(seq 1 $retry); + do + remote_sha1="$(curl -s "${remote_sha1_url}")" + if [[ "$remote_sha1" != "" ]]; then + break + fi + done + if [[ "$(cat "$local_sha1_file")" != "$remote_sha1" ]]; then echo "${download_to} is not up to date, corrupted or doesn't exist." echo "Downloading file from: ${remote_sha1_url}" @@ -155,6 +163,26 @@ if [ -n "${KUBEVIRT_CACHE_FROM}" ]; then fi make cluster-down + +# Create .bazelrc to use remote cache +cat >.bazelrc <.bazelrc <