add script to automatically release storage provisioner

pull/11402/head
Sharif Elgamal 2021-05-13 09:40:55 -07:00
parent c214b040e6
commit edd1230767
2 changed files with 69 additions and 0 deletions

View File

@ -736,7 +736,9 @@ TAG = $(STORAGE_PROVISIONER_TAG)
.PHONY: push-storage-provisioner-manifest
push-storage-provisioner-manifest: $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~storage\-provisioner\-image\-&~g") ## Push multi-arch storage-provisioner image
ifndef CIBUILD
docker login gcr.io/k8s-minikube
endif
set -x; for arch in $(ALL_ARCH); do docker push ${IMAGE}-$${arch}:${TAG}; done
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMAGE)\-&:$(TAG)~g")
set -x; for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-$${arch}:${TAG}; done

View File

@ -0,0 +1,67 @@
#!/bin/bash
# Copyright 2021 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -x -o pipefail
# Make sure docker is installed and configured
./hack/jenkins/installers/check_install_docker.sh
yes|gcloud auth configure-docker
# Make sure gh is installed and configured
./hack/jenkins/installers/check_install_gh.sh
# Grab current storage provisioner version and bump it
SP_VERSION=$(egrep "STORAGE_PROVISIONER_TAG \?=" Makefile | cut -d ' ' -f 3)
# SP_VERSION is going to be of the form "v4", grab that number, increment it, and tack the v back on
RAW_VERSION=${SP_VERSION:1}
RAW_VERSION=$((RAW_VERSION+1))
SP_VERSION=v${RAW_VERSION}
SED="sed -i"
if [ "$(uname)" == "Darwin" ]; then
SED="sed -i ''"
fi
# Write the new version back into the Makefile
${SED} "s/STORAGE_PROVISIONER_TAG ?= .*/STORAGE_PROVISIONER_TAG ?= ${SP_VERSION}/" Makefile
# Build the new image
CIBUILD=yes make push-storage-provisioner-manifest
ec=$?
if [ $ec -gt 0 ]; then
exit $ec
fi
# Bump the preload version
PLV=$(egrep "PreloadVersion =" pkg/minikube/download/preload.go | cut -d \" -f 2)
RAW=${PLV:1}
RAW=$((RAW+1))
PLV=v${RAW}
${SED} "s/PreloadVersion = .*/PreloadVersion = \"${PLV}\"/" pkg/minikube/download/preload.go
# Open a PR with the changes
branch=storage-provisioner-${SP_VERSION}
git checkout -b ${branch}
git add Makefile pkg/minikube/download/preload.go
git commit -m "Update storage provisioner to ${SP_VERSION}"
git remote add minikube-bot git@github.com:minikube-bot/minikube.git
git push -f minikube-bot ${branch}
gh pr create --fill --base master --head minikube-bot:${branch}