mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 13:44:57 +02:00
* feat: support more HELMFILE_* env vars as flag fallbacks
Adds env-var fallbacks for global flags, mirroring the existing
HELMFILE_ENVIRONMENT / HELMFILE_KUBE_CONTEXT pattern:
* --helm-binary -> HELMFILE_HELM_BINARY
* --kustomize-binary -> HELMFILE_KUSTOMIZE_BINARY
* --log-level -> HELMFILE_LOG_LEVEL
* --debug -> HELMFILE_DEBUG (expecting "true" lower case)
* --quiet -> HELMFILE_QUIET (expecting "true" lower case)
* --no-color -> HELMFILE_NO_COLOR (expecting "true" lower case),
additionally honors NO_COLOR per no-color.org
(any non-empty value disables color)
Flag values still take precedence; env vars are consulted only when the
flag is unset. The string-flag default values ("helm", "kustomize",
"info") move into the accessor methods so the env-var fallback can
actually trigger when no flag is passed.
Signed-off-by: Dominik Schmidt <dev@dominik-schmidt.de>
* docs: mention new HELMFILE_* env vars in cli.md and templating.md
Signed-off-by: Dominik Schmidt <dev@dominik-schmidt.de>
* fix: make Color/NoColor/env interaction consistent
Two issues with the env-aware NoColor() introduced together with
HELMFILE_NO_COLOR / NO_COLOR support:
1. Color() consulted the raw GlobalOptions.NoColor field instead of
NoColor(), so in a TTY with only the env set, Color() fell through
to terminal autodetect and ValidateConfig() spuriously errored with
"--color and --no-color cannot be specified at the same time".
2. NoColor() returned true via env even when --color was explicitly
passed, so `helmfile --color` with NO_COLOR (or HELMFILE_NO_COLOR=true)
in the environment hit the same ValidateConfig() error. A flag should
always win over an env var.
Fix both by routing Color() through NoColor() and giving NoColor() an
explicit --color short-circuit. Regression tests added for both paths.
Signed-off-by: Dominik Schmidt <dev@dominik-schmidt.de>
---------
Signed-off-by: Dominik Schmidt <dev@dominik-schmidt.de>
46 lines
2.3 KiB
Go
46 lines
2.3 KiB
Go
package envvar
|
|
|
|
const (
|
|
DisableInsecureFeatures = "HELMFILE_DISABLE_INSECURE_FEATURES"
|
|
|
|
// use helm status to check if a release exists before installing it
|
|
UseHelmStatusToCheckReleaseExistence = "HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE"
|
|
|
|
DisableRunnerUniqueID = "HELMFILE_DISABLE_RUNNER_UNIQUE_ID"
|
|
Experimental = "HELMFILE_EXPERIMENTAL" // environment variable for experimental features, expecting "true" lower case
|
|
Environment = "HELMFILE_ENVIRONMENT"
|
|
KubeContext = "HELMFILE_KUBE_CONTEXT"
|
|
Namespace = "HELMFILE_NAMESPACE"
|
|
HelmBinary = "HELMFILE_HELM_BINARY"
|
|
KustomizeBinary = "HELMFILE_KUSTOMIZE_BINARY"
|
|
LogLevel = "HELMFILE_LOG_LEVEL"
|
|
Debug = "HELMFILE_DEBUG"
|
|
Quiet = "HELMFILE_QUIET"
|
|
NoColor = "HELMFILE_NO_COLOR"
|
|
FilePath = "HELMFILE_FILE_PATH"
|
|
TempDir = "HELMFILE_TEMPDIR"
|
|
UpgradeNoticeDisabled = "HELMFILE_UPGRADE_NOTICE_DISABLED"
|
|
GoYamlV3 = "HELMFILE_GO_YAML_V3"
|
|
CacheHome = "HELMFILE_CACHE_HOME"
|
|
Interactive = "HELMFILE_INTERACTIVE"
|
|
RenderYaml = "HELMFILE_RENDER_YAML" // force helmfile.yaml to be rendered as template regardless of extension, expecting "true" lower case
|
|
|
|
// AWSSDKLogLevel controls AWS SDK logging level
|
|
// Valid values: "off" (default), "minimal", "standard", "verbose", or custom (e.g., "request,response")
|
|
// - "off": No AWS SDK logging (secure default, prevents credential leakage)
|
|
// - "minimal": Log retries only
|
|
// - "standard": Log retries and requests (previous default behavior)
|
|
// - "verbose": Log everything (requests, responses, bodies, signing)
|
|
// - Custom: Comma-separated AWS SDK log modes
|
|
// This is passed to vals Options.AWSLogLevel
|
|
// Can be overridden by AWS_SDK_GO_LOG_LEVEL environment variable
|
|
// See issue #2270 and vals PR #893
|
|
AWSSDKLogLevel = "HELMFILE_AWS_SDK_LOG_LEVEL"
|
|
|
|
// ValsFailOnMissingKeyInMap controls whether vals should fail when a key is missing in a map.
|
|
// When set to "true", vals returns an error if a referenced key does not exist in the secret map.
|
|
// Default is false for backward compatibility (returns empty string for missing keys).
|
|
// See issue #1563
|
|
ValsFailOnMissingKeyInMap = "HELMFILE_VALS_FAIL_ON_MISSING_KEY_IN_MAP"
|
|
)
|