diff --git a/hack/jenkins/common.sh b/hack/jenkins/common.sh index f1c07e668cff..9b89ebdfd4cf 100755 --- a/hack/jenkins/common.sh +++ b/hack/jenkins/common.sh @@ -91,7 +91,7 @@ else fi # installing golang so we could do go get for gopogh -sudo ARCH="$ARCH"./installers/check_install_golang.sh "1.16.4" "/usr/local" || true +./installers/check_install_golang.sh "1.16.4" "/usr/local" || true # install docker and kubectl if not present sudo ARCH="$ARCH" ./installers/check_install_docker.sh || true @@ -444,11 +444,11 @@ if [ -z "${EXTERNAL}" ]; then echo ">> public URL: ${REPORT_URL_BASE}/${JOB_GCS_BUCKET}.json" gsutil -qm cp "${JSON_OUT}" "gs://${JOB_GCS_BUCKET}.json" || true - echo ">> uploading ${HTML_OUT} to ${REPORT_URL_BASE}/${JOB_GCS_BUCKET}.html" + echo ">> uploading ${HTML_OUT} to gs://${JOB_GCS_BUCKET}.html" echo ">> public URL: ${REPORT_URL_BASE}/${JOB_GCS_BUCKET}.html" gsutil -qm cp "${HTML_OUT}" "gs://${JOB_GCS_BUCKET}.html" || true - echo ">> uploading ${SUMMARY_OUT} to ${REPORT_URL_BASE}/${JOB_GCS_BUCKET}_summary.json" + echo ">> uploading ${SUMMARY_OUT} to gs://${JOB_GCS_BUCKET}_summary.json" echo ">> public URL: ${REPORT_URL_BASE}/${JOB_GCS_BUCKET}_summary.json" gsutil -qm cp "${SUMMARY_OUT}" "gs://${JOB_GCS_BUCKET}_summary.json" || true else diff --git a/hack/jenkins/installers/check_install_golang.sh b/hack/jenkins/installers/check_install_golang.sh index 866e1139c34f..4ee97d5b1c24 100755 --- a/hack/jenkins/installers/check_install_golang.sh +++ b/hack/jenkins/installers/check_install_golang.sh @@ -67,20 +67,28 @@ function check_and_install_golang() { # install_golang takes two parameters version and path to install. function install_golang() { - echo "Installing golang version: $1 on $2" - pushd /tmp >/dev/null + local -r GO_VER="$1" + local -r GO_DIR="$2/go" + echo "Installing golang version: $GO_VER in $GO_DIR" INSTALLOS=linux if [[ "$OSTYPE" == "darwin"* ]]; then INSTALLOS=darwin fi + + local -r GO_TGZ="go${GO_VER}.${INSTALLOS}-${ARCH}.tar.gz" + pushd /tmp + # using sudo because previously installed versions might have been installed by a different user. # as it was the case on jenkins VM. - sudo curl -qL -O "https://storage.googleapis.com/golang/go${1}.${INSTALLOS}-${ARCH}.tar.gz" && - sudo tar -xzf go${1}.${INSTALLOS}-${ARCH}.tar.gz && - sudo rm -rf "${2}/go" && - sudo mv go "${2}/" && sudo chown -R $(whoami): ${2}/go + sudo rm -rf "$GO_TGZ" + curl -qL -O "https://storage.googleapis.com/golang/$GO_TGZ" + sudo rm -rf "$GO_DIR" + sudo mkdir -p "$GO_DIR" + sudo tar -C "$GO_DIR" --strip-components=1 -xzf "$GO_TGZ" + popd >/dev/null + echo "installed in $GO_DIR: $($GO_DIR/bin/go version)" } check_and_install_golang