Only call gsutil for non-alpha/beta releases, remove invalid GOPATH

pull/5261/head
Thomas Stromberg 2019-09-04 11:27:12 -07:00
parent 964f11b85e
commit fe6527f8d5
1 changed files with 23 additions and 20 deletions

View File

@ -24,30 +24,33 @@
# BUCKET: The GCP bucket the build files should be uploaded to. # BUCKET: The GCP bucket the build files should be uploaded to.
# GITHUB_TOKEN: The Github API access token. Injected by the Jenkins credential provider. # GITHUB_TOKEN: The Github API access token. Injected by the Jenkins credential provider.
set -e set -eux -o pipefail
readonly VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}"
export TAGNAME=v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} readonly TAGNAME="v${VERSION}"
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
# Make sure the tag matches the Makefile # Make sure the tag matches the Makefile
cat Makefile | grep "VERSION_MAJOR ?=" | grep $VERSION_MAJOR grep -E "^VERSION_MAJOR \\?=" Makefile | grep "${VERSION_MAJOR}"
cat Makefile | grep "VERSION_MINOR ?=" | grep $VERSION_MINOR grep -E "^VERSION_MINOR \\?=" Makefile | grep "${VERSION_MINOR}"
cat Makefile | grep "VERSION_BUILD ?=" | grep $VERSION_BUILD grep -E "^VERSION_BUILD \\?=" Makefile | grep "${VERSION_BUILD}"
# Build and upload # Build and upload
BUILD_IN_DOCKER=y make -j 16 all out/minikube-installer.exe \ env BUILD_IN_DOCKER=y \
out/minikube_${DEB_VERSION}.deb out/minikube-${RPM_VERSION}.rpm \ make -j 16 \
out/docker-machine-driver-kvm2_${DEB_VERSION}.deb out/docker-machine-driver-kvm2-${RPM_VERSION}.rpm 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 make checksum
gsutil -m cp out/* gs://$BUCKET/releases/$TAGNAME/ gsutil -m cp out/* "gs://$BUCKET/releases/$TAGNAME/"
# Bump latest # Update "latest" release for non-beta/non-alpha builds
gsutil cp -r gs://$BUCKET/releases/$TAGNAME/* gs://$BUCKET/releases/latest/ 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