From feb951d141b24ce1bead32e936b38a766bbdc54f Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Mon, 23 Mar 2020 11:52:22 +0100 Subject: [PATCH] Default to master branch in gcbmgr A sane default for the branch in gcbmgr is the master branch, where we can now simplify error handling paths as well. Signed-off-by: Sascha Grunert --- cmd/krel/cmd/gcbmgr.go | 13 ++++--------- docs/krel/gcbmgr.md | 6 +++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/cmd/krel/cmd/gcbmgr.go b/cmd/krel/cmd/gcbmgr.go index 0963e91731a..b00faa71fe0 100644 --- a/cmd/krel/cmd/gcbmgr.go +++ b/cmd/krel/cmd/gcbmgr.go @@ -95,7 +95,7 @@ func init() { gcbmgrCmd.PersistentFlags().StringVar( &gcbmgrOpts.branch, "branch", - "", + git.Master, "Branch to run the specified GCB run against", ) @@ -321,12 +321,7 @@ func setGCBSubstitutions(o *gcbmgrOptions) (map[string]string, error) { gcbSubs["RC"] = "" } - branch := o.branch - if branch == "" { - return gcbSubs, errors.New("Release branch must be set to continue") - } - - gcbSubs["RELEASE_BRANCH"] = branch + gcbSubs["RELEASE_BRANCH"] = o.branch if o.stage { // TODO: Remove once we remove support for --built-at-head. @@ -357,8 +352,8 @@ func setGCBSubstitutions(o *gcbmgrOptions) (map[string]string, error) { gcbSubs["BUILDVERSION"] = buildVersion kubecrossBranches := []string{ - branch, - "master", + o.branch, + git.Master, } kubecrossVersion, kubecrossVersionErr := release.GetKubecrossVersion(kubecrossBranches...) diff --git a/docs/krel/gcbmgr.md b/docs/krel/gcbmgr.md index 8a59ccc0aaa..7dcee074c2c 100644 --- a/docs/krel/gcbmgr.md +++ b/docs/krel/gcbmgr.md @@ -35,7 +35,7 @@ Simply [install krel](README.md#installation). ``` Flags: - --branch string Branch to run the specified GCB run against + --branch string Branch to run the specified GCB run against (default "master") --build-version string Build version --gcb-config string If provided, this will be used as the name of the Google Cloud Build config file. (default "cloudbuild.yaml") --gcp-user string If provided, this will be used as the GCP_USER_TAG. @@ -56,6 +56,8 @@ Global Flags: ## Important notes - Default executions of `krel gcbmgr` run in mock mode. To run an actual stage or release, you **MUST** provide the `--nomock` flag. +- Note that the default `--branch` is set to `master`, which means that it needs + to be set to the release branch if necessary. - Always execute the release process in the following order: - mock stage: `krel gcbmgr --stage` - mock release: `krel gcbmgr --release` @@ -81,7 +83,6 @@ Global Flags: ```shell krel gcbmgr --stage \ - --branch master \ --project kubernetes-release-test ``` @@ -89,7 +90,6 @@ krel gcbmgr --stage \ ```shell krel gcbmgr --release \ - --branch master \ --project kubernetes-release-test \ --build-version ```