diff --git a/docs/development/release.md b/docs/development/release.md index c5dfea76ba..69086af699 100644 --- a/docs/development/release.md +++ b/docs/development/release.md @@ -10,7 +10,7 @@ The kops project is released on an as-needed basis. The process is as follows: ## Branches -We maintain a `release-1.4` branch for kops 1.4.X, `release-1.5` for kops 1.5.X +We maintain a `release-1.16` branch for kops 1.16.X, `release-1.17` for kops 1.17.X etc. `master` is where development happens. We create new branches from master as a @@ -34,10 +34,26 @@ the current `release-1.X` tag. See [1.5.0-alpha4 commit](https://github.com/kubernetes/kops/commit/a60d7982e04c273139674edebcb03c9608ba26a0) for example -* Edit makefile -* If updating dns-controller: bump version in Makefile, code, manifests, and tests +* Use the hack/set-version script to update versions: `hack/set-version 1.20.0 1.20.1` -`git commit -m "Release 1.X.Y` +The syntax is `hack/set-version ` + +`new-release-version` is the version you are releasing. + +`new-ci-version` is the version you are releasing "plus one"; this is used to avoid CI jobs being out of semver order. + +Examples: + +| new-release-version | new-ci-version +| ---------------------| --------------- +| 1.20.1 | 1.20.2 +| 1.21.0-alpha.1 | 1.21.0-alpha.2 +| 1.21.0-beta.1 | 1.21.0-beta.2 + + +* Update the golden tests: `hack/update-expected.sh` + +* Commit the changes (without pushing yet): `git commit -m "Release 1.X.Y"` ## Check builds OK @@ -47,10 +63,13 @@ make ci ``` -## Push new dns-controller image if needed +## Push new kops-controller / dns-controller images ``` -make dns-controller-push DOCKER_REGISTRY=kope +# For versions prior to 1.18: make dns-controller-push DOCKER_REGISTRY=kope +make dns-controller-push DOCKER_IMAGE_PREFIX=kope/ DOCKER_REGISTRY=index.docker.io + +make kops-controller-push DOCKER_IMAGE_PREFIX=kope/ DOCKER_REGISTRY=index.docker.io ``` ## Upload new version @@ -68,6 +87,9 @@ Make sure you are on the release branch `git checkout release-1.X` make release-tag git push git@github.com:kubernetes/kops git push --tags git@github.com:kubernetes/kops + +# Sync the origin alias back up +git fetch origin ``` ## Update release branch @@ -75,7 +97,7 @@ git push --tags git@github.com:kubernetes/kops For the time being, we are also maintaining a release branch. We push released versions to that. -`git push origin release-1.8:release` +`git push git@github.com:kubernetes/kops release-1.17:release` ## Pull request to master branch (for release commit) diff --git a/hack/set-version b/hack/set-version new file mode 100755 index 0000000000..9a4cb6aead --- /dev/null +++ b/hack/set-version @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Copyright 2020 The Kubernetes Authors. +# +# 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. + +# This script helps with updating versions across the repo, updating the +# multiple places where we encode a kops version number. + +# Use: hack/set-version + +# new-release-version is the version you are releasing. + +# new-ci-version is the version you are releasing + 1; +# this is used to avoid CI jobs being out of semver order. +# +# Examples: +# new-release-version new-ci-version +# 1.20.1 1.20.2 +# 1.21.0-alpha.1 1.21.0-alpha.2 +# 1.21.0-beta.1 1.21.0-beta.2 + +set -e +set -x + +NEW_RELEASE_VERSION=$1 +NEW_CI_VERSION=$2 + +if [[ -z "${NEW_CI_VERSION}" ]]; then + echo "syntax $0 " + exit 1 +fi + +KOPS_RELEASE_VERSION=`grep 'KOPS_RELEASE_VERSION\s*=' version.go | awk '{print $3}' | sed -e 's_"__g'` +KOPS_CI_VERSION=`grep 'KOPS_CI_VERSION\s*=' version.go | awk '{print $3}' | sed -e 's_"__g'` + +echo "KOPS_RELEASE_VERSION ${KOPS_RELEASE_VERSION} -> ${NEW_RELEASE_VERSION}" +echo "KOPS_CI_VERSION ${KOPS_CI_VERSION} -> ${NEW_CI_VERSION}" + +sed -i -e "s@DNS_CONTROLLER_TAG=${KOPS_RELEASE_VERSION}@DNS_CONTROLLER_TAG=${NEW_RELEASE_VERSION}@g" Makefile +sed -i -e "s@KOPS_CONTROLLER_TAG=${KOPS_RELEASE_VERSION}@KOPS_CONTROLLER_TAG=${NEW_RELEASE_VERSION}@g" Makefile +sed -i -e "s@\"${KOPS_RELEASE_VERSION}\"@\"${NEW_RELEASE_VERSION}\"@g" upup/pkg/fi/cloudup/bootstrapchannelbuilder.go + +git grep -l kope/dns-controller | xargs -I {} sed -i -e "s@dns-controller:${KOPS_RELEASE_VERSION}@dns-controller:${NEW_RELEASE_VERSION}@g" {} +git grep -l "version..v${KOPS_RELEASE_VERSION}" upup/models/cloudup/resources/addons/dns-controller.addons.k8s.io/ | xargs -I {} sed -i -e "s@version: v${KOPS_RELEASE_VERSION}@version: v${NEW_RELEASE_VERSION}@g" {} + +git grep -l kope/kops-controller | xargs -I {} sed -i -e "s@kops-controller:${KOPS_RELEASE_VERSION}@kops-controller:${NEW_RELEASE_VERSION}@g" {} +git grep -l "version..v${KOPS_RELEASE_VERSION}" upup/models/cloudup/resources/addons/kops-controller.addons.k8s.io/ | xargs -I {} sed -i -e "s@version: v${KOPS_RELEASE_VERSION}@version: v${NEW_RELEASE_VERSION}@g" {} + +git grep -l "version..${KOPS_RELEASE_VERSION}" upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/ | xargs -I {} sed -i -e "s@version: ${KOPS_RELEASE_VERSION}@version: ${NEW_RELEASE_VERSION}@g" {} + +sed -i -e "s@${KOPS_CI_VERSION}@${NEW_CI_VERSION}@g" version.go +sed -i -e "s@${KOPS_RELEASE_VERSION}@${NEW_RELEASE_VERSION}@g" version.go