Add MergeMapsWithArrayMerge and IsCLIOverride flag - WIP fixing array merging issue

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-07 01:35:11 +00:00
co-authored by yxxhero
parent 66751a845b
commit 1802fd4888
8 changed files with 162 additions and 21 deletions
+3 -3
View File
@@ -412,9 +412,9 @@ func (c *StateCreator) loadEnvValues(st *HelmState, name string, failOnMissingEn
if overrode != nil {
intOverrodeEnv := *newEnv
// Use MergeMaps instead of mergo.Merge to properly handle array merging element-by-element
// This fixes issue #2281 where arrays were being replaced entirely instead of merged
intOverrodeEnv.Values = maputil.MergeMaps(intOverrodeEnv.Values, overrode.Values)
// Use MergeMapsWithArrayMerge instead of mergo.Merge to properly handle array merging element-by-element
// This fixes issue #2281 where arrays from --state-values-set were being replaced entirely instead of merged
intOverrodeEnv.Values = maputil.MergeMapsWithArrayMerge(intOverrodeEnv.Values, overrode.Values)
newEnv = &intOverrodeEnv
}
+3
View File
@@ -150,6 +150,9 @@ type SubHelmfileSpec struct {
// SubhelmfileEnvironmentSpec is the environment spec for a subhelmfile
type SubhelmfileEnvironmentSpec struct {
OverrideValues []any `yaml:"values,omitempty"`
// CLISet is set internally to pass CLI overrides from --state-values-set
// This is not part of the YAML spec
CLISet map[string]any `yaml:"-"`
}
// HelmSpec to defines helmDefault values