feat: add HELMFILE_INTERACTIVE env var to enable interactive mode (#1787)
* feat: add HELMFILE_INTERACTIVE env var to enable interactive mode This commit adds the `HELMFILE_INTERACTIVE` environment variable to enable the interactive mode by default. Anything other than `true` will disable the interactive mode. The precedence has the `--interactive` flag. Signed-off-by: Krzysztof Łuczak <krzysztof.luczak.pro@gmail.com> * Trim trailing whitespaces Signed-off-by: Krzysztof Łuczak <krzysztof.luczak.pro@gmail.com> --------- Signed-off-by: Krzysztof Łuczak <krzysztof.luczak.pro@gmail.com>
This commit is contained in:
		
							parent
							
								
									0b1746bdf3
								
							
						
					
					
						commit
						4287471acc
					
				|  | @ -551,6 +551,7 @@ Helmfile uses some OS environment variables to override default behaviour: | ||||||
| * `HELMFILE_GOCCY_GOYAML` - use *goccy/go-yaml* instead of *gopkg.in/yaml.v2*.  It's `false` by default in Helmfile v0.x and `true` by default for Helmfile v1.x. | * `HELMFILE_GOCCY_GOYAML` - use *goccy/go-yaml* instead of *gopkg.in/yaml.v2*.  It's `false` by default in Helmfile v0.x and `true` by default for Helmfile v1.x. | ||||||
| * `HELMFILE_CACHE_HOME` - specify directory to store cached files for remote operations | * `HELMFILE_CACHE_HOME` - specify directory to store cached files for remote operations | ||||||
| * `HELMFILE_FILE_PATH` - specify the path to the helmfile.yaml file | * `HELMFILE_FILE_PATH` - specify the path to the helmfile.yaml file | ||||||
|  | * `HELMFILE_INTERACTIVE` - enable interactive mode, expecting `true` lower case. The same as `--interactive` CLI flag | ||||||
| 
 | 
 | ||||||
| ## CLI Reference | ## CLI Reference | ||||||
| 
 | 
 | ||||||
|  | @ -1657,6 +1658,9 @@ Use it when you're running `helmfile` manually on your local machine or a kind o | ||||||
| 
 | 
 | ||||||
| For your local use-case, aliasing it like `alias hi='helmfile --interactive'` would be convenient. | For your local use-case, aliasing it like `alias hi='helmfile --interactive'` would be convenient. | ||||||
| 
 | 
 | ||||||
|  | Another way to use it is to set the environment variable `HELMFILE_INTERACTIVE=true` to enable the interactive mode by default. | ||||||
|  | Anything other than `true` will disable the interactive mode. The precedence has the `--interactive` flag. | ||||||
|  | 
 | ||||||
| ## Running Helmfile without an Internet connection | ## Running Helmfile without an Internet connection | ||||||
| 
 | 
 | ||||||
| Once you download all required charts into your machine, you can run `helmfile sync --skip-deps` to deploy your apps. | Once you download all required charts into your machine, you can run `helmfile sync --skip-deps` to deploy your apps. | ||||||
|  |  | ||||||
|  | @ -246,7 +246,10 @@ func (g *GlobalImpl) ValidateConfig() error { | ||||||
| 
 | 
 | ||||||
| // Interactive returns the Interactive
 | // Interactive returns the Interactive
 | ||||||
| func (g *GlobalImpl) Interactive() bool { | func (g *GlobalImpl) Interactive() bool { | ||||||
| 	return g.GlobalOptions.Interactive | 	if g.GlobalOptions.Interactive { | ||||||
|  | 		return true | ||||||
|  | 	} | ||||||
|  | 	return os.Getenv(envvar.Interactive) == "true" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Args returns the args to use for helm
 | // Args returns the args to use for helm
 | ||||||
|  |  | ||||||
|  | @ -18,4 +18,5 @@ const ( | ||||||
| 	V1Mode                = "HELMFILE_V1MODE" | 	V1Mode                = "HELMFILE_V1MODE" | ||||||
| 	GoccyGoYaml           = "HELMFILE_GOCCY_GOYAML" | 	GoccyGoYaml           = "HELMFILE_GOCCY_GOYAML" | ||||||
| 	CacheHome             = "HELMFILE_CACHE_HOME" | 	CacheHome             = "HELMFILE_CACHE_HOME" | ||||||
|  | 	Interactive           = "HELMFILE_INTERACTIVE" | ||||||
| ) | ) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue