From fe6527f8d5ebfb655e14495ec2e891f7e00fbf4a Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Wed, 4 Sep 2019 11:27:12 -0700 Subject: [PATCH] Only call gsutil for non-alpha/beta releases, remove invalid GOPATH --- hack/jenkins/release_build_and_upload.sh | 43 +++++++++++++----------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/hack/jenkins/release_build_and_upload.sh b/hack/jenkins/release_build_and_upload.sh index 4f9259843e..d70f7719ef 100755 --- a/hack/jenkins/release_build_and_upload.sh +++ b/hack/jenkins/release_build_and_upload.sh @@ -24,30 +24,33 @@ # BUCKET: The GCP bucket the build files should be uploaded to. # GITHUB_TOKEN: The Github API access token. Injected by the Jenkins credential provider. -set -e - -export TAGNAME=v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} -export DEB_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} -export RPM_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} -export GOPATH=~/go - -# Make sure the right golang version is installed based on Makefile -WANT_GOLANG_VERSION=$(grep '^GO_VERSION' Makefile | awk '{ print $3 }') -./hack/jenkins/installers/check_install_golang.sh $WANT_GOLANG_VERSION /usr/local - +set -eux -o pipefail +readonly VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}" +readonly TAGNAME="v${VERSION}" # Make sure the tag matches the Makefile -cat Makefile | grep "VERSION_MAJOR ?=" | grep $VERSION_MAJOR -cat Makefile | grep "VERSION_MINOR ?=" | grep $VERSION_MINOR -cat Makefile | grep "VERSION_BUILD ?=" | grep $VERSION_BUILD +grep -E "^VERSION_MAJOR \\?=" Makefile | grep "${VERSION_MAJOR}" +grep -E "^VERSION_MINOR \\?=" Makefile | grep "${VERSION_MINOR}" +grep -E "^VERSION_BUILD \\?=" Makefile | grep "${VERSION_BUILD}" # Build and upload -BUILD_IN_DOCKER=y make -j 16 all out/minikube-installer.exe \ -out/minikube_${DEB_VERSION}.deb out/minikube-${RPM_VERSION}.rpm \ -out/docker-machine-driver-kvm2_${DEB_VERSION}.deb out/docker-machine-driver-kvm2-${RPM_VERSION}.rpm +env BUILD_IN_DOCKER=y \ + make -j 16 \ + all \ + out/minikube-installer.exe \ + "out/minikube_${VERSION}.deb" \ + "out/minikube-${VERSION}.rpm" \ + "out/docker-machine-driver-kvm2_${VERSION}.deb" \ + "out/docker-machine-driver-kvm2-${VERSION}.rpm" + make checksum -gsutil -m cp out/* gs://$BUCKET/releases/$TAGNAME/ +gsutil -m cp out/* "gs://$BUCKET/releases/$TAGNAME/" -# Bump latest -gsutil cp -r gs://$BUCKET/releases/$TAGNAME/* gs://$BUCKET/releases/latest/ +# Update "latest" release for non-beta/non-alpha builds +if ! [[ ${VERSION_BUILD} =~ ^[0-9]+$ ]]; then + echo "NOTE: ${VERSION} appears to be a non-standard release, not updating /releases/latest" +else + echo "Updating latest bucket for ${VERSION} release" + gsutil cp -r "gs://${BUCKET}/releases/${TAGNAME}/*" "gs://${BUCKET}/releases/latest/" +fi \ No newline at end of file