Skip to content

Commit

Permalink
fix flags
Browse files Browse the repository at this point in the history
  • Loading branch information
tashima42 committed Aug 2, 2024
1 parent 843b400 commit 799730d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

ECM Distro Tools is a collection of utilities that provide for easier administration, management, and interaction with the great Rancher ecosystems, including RKE2 and K3s.

## Release CLI
### Configuration
**New Configuration File**
```bash
release config gen > $HOME/.ecm-distro-tools/config.json
```
**Load config from custom path**
```bash
release config view -c ./config.json
```
**Load config from string
```bash
release generate rancher missing-images-list v2.7.15 -C '{"rancher": { "versions": {"v2.7.15": {"check_images": ["rancher/rancher:v2.7.15"]}}}}' -i "https://prime.ribs.rancher.io/rancher/v2.7.15/rancher-images.txt" --ignore-validate
```


## Building

There's a mix of code in this repository. The shell scripts and shell libraries reside in the `bin` directory and are ready to use. The Go programs are rooted in the `cmd` directory and need to be compiled.
Expand Down
2 changes: 1 addition & 1 deletion cmd/release/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func init() {
}

// rancher generate missing-images-list
rancherGenerateMissingImagesListSubCmd.Flags().IntVarP(&concurrencyLimit, "concurrency-limit", "c", 3, "Concurrency Limit")
rancherGenerateMissingImagesListSubCmd.Flags().IntVarP(&concurrencyLimit, "concurrency-limit", "l", 3, "Concurrency Limit")
rancherGenerateMissingImagesListSubCmd.Flags().BoolVarP(&rancherMissingImagesJSONOutput, "json", "j", false, "JSON Output")
rancherGenerateMissingImagesListSubCmd.Flags().StringVarP(&imagesListURL, "images-list-url", "i", "", "URL of the artifact containing all images for a given version 'rancher-images.txt' (required)")
if err := rancherGenerateMissingImagesListSubCmd.MarkFlagRequired("images-list-url"); err != nil {
Expand Down
22 changes: 13 additions & 9 deletions cmd/release/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
)

var (
debug bool
dryRun bool
rootConfig *config.Config
configFile string
stringConfig string
debug bool
dryRun bool
ignoreValidate bool
rootConfig *config.Config
configFile string
stringConfig string
)

// rootCmd represents the base command when called without any subcommands
Expand All @@ -38,8 +39,9 @@ func SetVersion(version string) {
}

func init() {
rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Debug")
rootCmd.PersistentFlags().BoolVarP(&dryRun, "dry-run", "r", false, "Drun Run")
rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "D", false, "Debug")
rootCmd.PersistentFlags().BoolVarP(&dryRun, "dry-run", "R", false, "Drun Run")
rootCmd.PersistentFlags().BoolVarP(&ignoreValidate, "ignore-validate", "I", false, "Ignore the validate config step")
rootCmd.PersistentFlags().StringVarP(&configFile, "config-file", "c", "$HOME/.ecm-distro-tools/config.json", "Path for the config.json file")
rootCmd.PersistentFlags().StringVarP(&stringConfig, "config", "C", "", "JSON config string")
}
Expand Down Expand Up @@ -68,7 +70,9 @@ func initConfig() {

rootConfig = conf

if err := rootConfig.Validate(); err != nil {
panic(err)
if !ignoreValidate {
if err := rootConfig.Validate(); err != nil {
panic(err)
}
}
}

0 comments on commit 799730d

Please sign in to comment.