mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-20 22:52:51 +02:00
* fix: retry rendering with lenient requiredEnv when selectors are active (#1172) The entire helmfile document is rendered as a Go template before selector labels filter releases. This means requiredEnv calls in releases excluded by selectors still fail, blocking the whole run. When selectors are active and rendering fails due to a requiredEnv error, helmfile now retries with lenient mode: unset env vars produce empty strings instead of failing. The document can then be parsed and filtered by selectors normally. Behavior: - Without selectors: requiredEnv fails as before (validation preserved) - With selectors, all env vars set: strict render succeeds, no retry - With selectors, some env vars missing: lenient retry, excluded releases get empty values and are filtered out by selectors Implementation: - Add RequiredEnvError type + ErrRequiredEnvNotSet sentinel for type-safe error detection via errors.As - Add lenientRequiredEnv flag to tmpl.Context; requiredEnv returns empty string instead of failing when set - Add NewLenientFileRenderer via functional options pattern (FileRendererOption / WithPreRender / WithLenientRequiredEnv) - Extract renderWithSelectorFallback in two_pass_renderer.go - Pass selectors from LoadOpts to desiredStateLoader Closes #1172 Signed-off-by: yxxhero <yxxhero@example.com> Signed-off-by: yxxhero <aiopsclub@163.com> * test: add integration test for selector filtering with requiredEnv (#1172) Verify that selector-based filtering works correctly when requiredEnv is used in release values. Users set all required env vars, so rendering succeeds, and selectors filter out non-matching releases. Test scenarios: - helmfile template -l tier=label2: only rel2 is templated (rel1 excluded) - helmfile template without selector: both releases are templated Closes #1172 Signed-off-by: yxxhero <yxxhero@example.com> Signed-off-by: yxxhero <aiopsclub@163.com> --------- Signed-off-by: yxxhero <yxxhero@example.com> Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -147,6 +147,7 @@ ${kubectl} create namespace ${test_ns} || fail "Could not create namespace ${tes
|
||||
. ${dir}/test-cases/issue-1880-transformers-with-file-deps.sh
|
||||
. ${dir}/test-cases/issue-821-adhoc-dep-go-getter.sh
|
||||
. ${dir}/test-cases/issue-2599-default-inherit.sh
|
||||
. ${dir}/test-cases/issue-1172-selector-required-env.sh
|
||||
. ${dir}/test-cases/kubedog-tracking.sh
|
||||
. ${dir}/test-cases/lookup.sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user