Skip to content

Commit

Permalink
Fix batch-apply-size and conditions to route different apply options (#…
Browse files Browse the repository at this point in the history
…511)

* Fix batch-apply-size and conditions to route different apply options

* docs(cobra): update auto-generated documentation

---------

Co-authored-by: poornima-krishnasamy <[email protected]>
  • Loading branch information
poornima-krishnasamy and poornima-krishnasamy committed Dec 11, 2023
1 parent 22aa6f6 commit 08c6f92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/cloud-platform_environment_apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $ cloud-platform environment apply -n <namespace>
```
--all-namespaces Apply all namespaces with -all-namespaces
--batch-apply-index int Starting index for Apply to a batch of namespaces
--batch-apply-size int Number of namespaces to apply in a batch (default 10)
--batch-apply-size int Number of namespaces to apply in a batch
--cluster string cluster context fron kubeconfig file
--clusterdir string folder name under namespaces/ inside cloud-platform-environments repo refering to full cluster name
--enable-apply-skip Enable skipping apply for a namespace
Expand Down
6 changes: 4 additions & 2 deletions pkg/commands/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func addEnvironmentCmd(topLevel *cobra.Command) {
// flags
environmentApplyCmd.Flags().BoolVar(&optFlags.AllNamespaces, "all-namespaces", false, "Apply all namespaces with -all-namespaces")
environmentApplyCmd.Flags().IntVar(&optFlags.BatchApplyIndex, "batch-apply-index", 0, "Starting index for Apply to a batch of namespaces")
environmentApplyCmd.Flags().IntVar(&optFlags.BatchApplySize, "batch-apply-size", 10, "Number of namespaces to apply in a batch")
environmentApplyCmd.Flags().IntVar(&optFlags.BatchApplySize, "batch-apply-size", 0, "Number of namespaces to apply in a batch")
environmentApplyCmd.Flags().BoolVar(&optFlags.EnableApplySkip, "enable-apply-skip", false, "Enable skipping apply for a namespace")
environmentApplyCmd.Flags().StringVarP(&optFlags.Namespace, "namespace", "n", "", "Namespace which you want to perform the apply")
environmentApplyCmd.Flags().IntVar(&optFlags.PRNumber, "prNumber", 0, "Pull request ID or number to which you want to perform the apply")
Expand Down Expand Up @@ -228,11 +228,13 @@ var environmentApplyCmd = &cobra.Command{
if err != nil {
contextLogger.Fatal(err)
}
} else {
} else if optFlags.Namespace != "" || optFlags.PRNumber > 0 {
err := applier.Apply()
if err != nil {
contextLogger.Fatal(err)
}
} else {
contextLogger.Fatal("Please provide either -all-namespaces or -namespace or -prNumber or -batch-apply-index and -batch-apply-size")
}
},
}
Expand Down

0 comments on commit 08c6f92

Please sign in to comment.