Commit a1a09e14 authored by Andy Cobaugh's avatar Andy Cobaugh

ci: flag requirements are shared. marking a flag as required on one command...

ci: flag requirements are shared. marking a flag as required on one command makes it required for all child commands, so only define image-tag within the subcommands that need it
parent 1c530865
Pipeline #106284 passed with stage
in 22 seconds
......@@ -48,17 +48,7 @@ var ciCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(ciCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// configCmd.PersistentFlags().String("foo", "", "A help for foo")
ciCmd.PersistentFlags().StringVarP(&environmentSuffix, "environment", "e", "", "environment suffix to append to helm release name")
ciCmd.PersistentFlags().StringVarP(&imageTag, "image-tag", "i", "", "image tag for docker")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// configCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
func getCiConfiguration() config.Config {
......
......@@ -82,6 +82,7 @@ func init() {
panic("invalid arg")
}
ciBuildCmd.PersistentFlags().StringVarP(&imageTag, "image-tag", "i", "", "image tag for docker")
err = ciBuildCmd.MarkPersistentFlagRequired("image-tag")
if err != nil {
panic("invalid arg")
......
......@@ -40,6 +40,7 @@ var ciDeployCmd = &cobra.Command{
}
func init() {
ciDeployCmd.PersistentFlags().StringVarP(&imageTag, "image-tag", "i", "", "image tag for docker")
err := ciDeployCmd.MarkPersistentFlagRequired("image-tag")
if err != nil {
panic("invalid arg")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment