helmfile/pkg
yxxhero ca8fc293e9
fix: helmBinary setting ignored in multi-document YAML files (#2414)
* fix: helmBinary setting ignored in multi-document YAML files

The helmBinary setting in helmfile.yaml was being ignored when using
multi-document YAML files (files with --- separators).

Root Cause:
When processing multi-document YAML files, the load() function splits
the file into parts and processes each part separately. Each part was
calling applyDefaultsAndOverrides() which would set an empty helmBinary
to the default 'helm'. When merging parts, the default value from a
later part would override the correct value from an earlier part.

Fix:
- Added a new applyDefaults parameter to ParseAndLoad() to control when
  defaults are applied
- Modified rawLoad() to pass applyDefaults=false when processing
  individual parts
- Added a call to ApplyDefaultsAndOverrides() after all parts are merged
  to apply defaults once on the final merged state
- Exported ApplyDefaultsAndOverrides() method for use by the app package

Fixes: #2319
Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: update comment per PR review

Change 're-apply' to 'apply' since defaults are never applied during
part processing (applyDefaults=false is passed), so this is the first
and only time defaults are applied to the merged state.

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: clarify applyDefaults logic in test LoadFile callbacks

Add explicit applyDefaults variable with comment explaining why it
equals evaluateBases: base files shouldn't apply defaults, only the
main file should after all parts/bases are merged.

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: address PR review comments

- Remove applyDefaults parameter from rawLoad() since it's always false
- Add regression test for multi-document YAML with helmBinary (issue #2319)

Signed-off-by: yxxhero <aiopsclub@163.com>

* test: add integration test for helmBinary in multi-document YAML

Add TestHelmBinaryPreservedInMultiDocumentYAML that exercises the full
loadDesiredStateFromYaml path to ensure helmBinary from the first
document is preserved when merging multi-document YAML files.

This is a regression test at the load() orchestration level for issue #2319.

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-02-20 22:12:38 +08:00
..
app fix: helmBinary setting ignored in multi-document YAML files (#2414) 2026-02-20 22:12:38 +08:00
argparser
cluster 🐛 Fix four critical issues: environment merging, kubeVersion detection, lookup() with kustomize, and Helm 4 color flags (#2276) 2025-11-21 08:32:54 +08:00
config feat: add `helmfile unittest` command for helm-unittest integration (#2400) 2026-02-16 09:45:10 +08:00
environment fix: array merge regression - layer arrays now replace defaults (#2367) 2026-01-18 14:04:54 +08:00
envvar Add parameter to render helmfile as go template without .gotmpl extension (#2312) 2025-12-09 14:41:47 +09:00
errors
event
exectest feat: add `helmfile unittest` command for helm-unittest integration (#2400) 2026-02-16 09:45:10 +08:00
filesystem
hcllang
helmexec fix: support XDG-style multiple paths in HELM_PLUGINS (#2412) 2026-02-20 15:27:34 +08:00
maputil fix: array merge regression - layer arrays now replace defaults (#2367) 2026-01-18 14:04:54 +08:00
plugins Fix AWS SDK debug logging by making it configurable (issue #2270) (#2290) 2025-11-24 18:27:04 +08:00
policy
remote fix: include query params in HTTP getter cache key (#2399) 2026-02-14 09:31:53 +08:00
runtime refactor(yaml): switch yaml library import paths from gopkg.in to go.yaml.in (#2114) 2025-08-01 11:28:39 +08:00
state fix: helmBinary setting ignored in multi-document YAML files (#2414) 2026-02-20 22:12:38 +08:00
testhelper perf(app): Parallelize helmfile.d rendering and eliminate chdir race conditions (#2261) 2025-11-15 16:19:41 +08:00
testutil feat: add `helmfile unittest` command for helm-unittest integration (#2400) 2026-02-16 09:45:10 +08:00
tmpl refactor(yaml): switch yaml library import paths from gopkg.in to go.yaml.in (#2114) 2025-08-01 11:28:39 +08:00
yaml refactor(yaml): switch yaml library import paths from gopkg.in to go.yaml.in (#2114) 2025-08-01 11:28:39 +08:00