From 2f0835b6559704e4b2caf5e70f1de5f4930798bb Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 15 Jan 2021 13:16:53 +0200 Subject: [PATCH] Make branch arg required for image updates Signed-off-by: Stefan Prodan --- cmd/flux/create_image_updateauto.go | 6 +++++- docs/cmd/flux_create_image_update.md | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/flux/create_image_updateauto.go b/cmd/flux/create_image_updateauto.go index 0f1935f3..4379ed4d 100644 --- a/cmd/flux/create_image_updateauto.go +++ b/cmd/flux/create_image_updateauto.go @@ -50,7 +50,7 @@ var imageUpdateArgs = imageUpdateFlags{} func init() { flags := createImageUpdateCmd.Flags() flags.StringVar(&imageUpdateArgs.gitRepoRef, "git-repo-ref", "", "the name of a GitRepository resource with details of the upstream git repository") - flags.StringVar(&imageUpdateArgs.branch, "branch", "", "the branch to push commits to") + flags.StringVar(&imageUpdateArgs.branch, "branch", "", "the branch to checkout and push commits to") flags.StringVar(&imageUpdateArgs.commitTemplate, "commit-template", "", "a template for commit messages") flags.StringVar(&imageUpdateArgs.authorName, "author-name", "", "the name to use for commit author") flags.StringVar(&imageUpdateArgs.authorEmail, "author-email", "", "the email to use for commit author") @@ -68,6 +68,10 @@ func createImageUpdateRun(cmd *cobra.Command, args []string) error { return fmt.Errorf("a reference to a GitRepository is required (--git-repo-ref)") } + if imageUpdateArgs.branch == "" { + return fmt.Errorf("the Git repoistory branch is required (--branch)") + } + labels, err := parseLabels() if err != nil { return err diff --git a/docs/cmd/flux_create_image_update.md b/docs/cmd/flux_create_image_update.md index 7d96fa74..c5ea5140 100644 --- a/docs/cmd/flux_create_image_update.md +++ b/docs/cmd/flux_create_image_update.md @@ -17,7 +17,7 @@ flux create image update [flags] ``` --author-email string the email to use for commit author --author-name string the name to use for commit author - --branch string the branch to push commits to + --branch string the branch to checkout and push commits to --commit-template string a template for commit messages --git-repo-ref string the name of a GitRepository resource with details of the upstream git repository -h, --help help for update