From 60188ebe202414cb1d04dec0650c1a27c94e9a35 Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Mon, 16 Dec 2019 16:30:08 -0800 Subject: [PATCH] Address issues in release scripts - Merge in changes to branches - Get rid of releaseall.sh -- it is too error prone right now - Support for releasing pluginator - Automatically release binaries for kustomize --- releasing/VERSIONS | 10 +++++++--- releasing/releaseallmodules.sh | 21 --------------------- releasing/releasemodule.sh | 28 +++++++++++++++++++++------- 3 files changed, 28 insertions(+), 31 deletions(-) delete mode 100755 releasing/releaseallmodules.sh diff --git a/releasing/VERSIONS b/releasing/VERSIONS index e35ba377d..7ec4de9e6 100644 --- a/releasing/VERSIONS +++ b/releasing/VERSIONS @@ -6,7 +6,7 @@ # kyaml version export kyaml_major=0 export kyaml_minor=0 -export kyaml_patch=1 +export kyaml_patch=2 # kustomize api version export api_major=0 @@ -16,14 +16,18 @@ export api_patch=0 # cmd/config version export cmd_config_major=0 export cmd_config_minor=0 -export cmd_config_patch=1 +export cmd_config_patch=2 # cmd/kubectl version export cmd_kubectl_major=0 export cmd_kubectl_minor=0 -export cmd_kubectl_patch=1 +export cmd_kubectl_patch=2 # kustomize version export kustomize_major=3 export kustomize_minor=5 export kustomize_patch=1 + +export pluginator_major=2 +export pluginator_minor=1 +export pluginator_patch=0 diff --git a/releasing/releaseallmodules.sh b/releasing/releaseallmodules.sh deleted file mode 100755 index 87a146f60..000000000 --- a/releasing/releaseallmodules.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Copyright 2019 The Kubernetes Authors. -# SPDX-License-Identifier: Apache-2.0 - -set -e - -# fetch upstream once -git fetch upstream -export FETCH="false" - -# release modules without binaries -for module in "kyaml api cmd/config cmd/kubectl" -do - releasing/releasemodule.sh $module -done - -# release modules with binaries -for binary in "kustomize" -do - BINARY=true releasing/releasemodule.sh $binary -done diff --git a/releasing/releasemodule.sh b/releasing/releasemodule.sh index 4d1096d4c..cde4b7a33 100755 --- a/releasing/releasemodule.sh +++ b/releasing/releasemodule.sh @@ -4,11 +4,8 @@ # run this script with releasing/releasemodule.sh MODULE # -- e.g. releasing/releasemodule.sh cmd/config -# to push the latest tag to release a binary, run with BINARY=true -# -- e.g. BINARY=true releasing/releasemodule.sh kustomize # to skip fetch from upstream, run with FETCH=false # -- e.g. FETCH=false releasing/releasemodule.sh kyaml -# for a list of modules see releasing/releaseallmodules.sh set -e # perform release for a module @@ -28,11 +25,14 @@ function releaseModule { # create a temporary workspace for our work wktree=$(mktemp -d /tmp/kustomize-releases-XXXXXX) - git branch -f $branch upstream/master # always release from master + git branch $branch upstream/$branch git worktree add $wktree $branch # create a separate worktree for the branch pushd . cd $wktree/$module # cd into the worktree/module + # merge master changes into the release branch + git merge upstream/master + echo "dir: $wktree" echo "module: $module v$major.$minor.$patch" echo "branch: $branch" @@ -81,8 +81,22 @@ function releaseBinary { fi } +modules="kyaml api cmd/config cmd/kubectl pluginator kustomize" + # configure the branch and tag names -module="${1?must provide the module to release as an argument}" +module="${1?must provide the module to release as an argument: supported modules [$modules]}" + +# verify the module +found=false +for m in $modules; do + if [ "$m" == "$module" ]; then + found=true + fi +done +if [ "$found" != "true" ]; then + echo "unknown module \"$module\", must be one of: [$modules]" + exit 1 +fi # get the release versions source releasing/VERSIONS @@ -98,7 +112,7 @@ fi # release the module releaseModule $module -# release the binary -if [ "$BINARY" == "true" ]; then +# release the kustomize binary if the module is kustomize +if [ "$module" == "kustomize" ]; then releaseBinary $module fi