mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-17 21:15:53 +02:00
Fix array merging issue - distinguish CLI overrides from helmfile composition
- Add IsCLIOverride flag to Environment to track CLI overrides vs helmfile composition - Add CLISet field to SubhelmfileEnvironmentSpec to pass CLI overrides separately - Create MergeMapsWithArrayMerge for element-by-element array merging (CLI overrides) - Keep MergeMaps with array replacement (helmfile composition - documented behavior) - Preserve IsCLIOverride flag through Environment merges and copies - Fix LoadOpts.DeepCopy to preserve CLISet field - Add comprehensive unit tests for both behaviors This fixes the issue where array merging behavior from issue #2281 broke helmfile composition Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
co-authored by
yxxhero
parent
1802fd4888
commit
e400a0b936
@@ -401,10 +401,15 @@ func (c *StateCreator) loadEnvValues(st *HelmState, name string, failOnMissingEn
|
||||
|
||||
if ctxEnv != nil {
|
||||
intCtxEnv := *ctxEnv
|
||||
// Preserve the IsCLIOverride flag before merging
|
||||
wasCLIOverride := intCtxEnv.IsCLIOverride
|
||||
|
||||
if err := mergo.Merge(&intCtxEnv, newEnv, mergo.WithOverride); err != nil {
|
||||
return nil, fmt.Errorf("error while merging environment values for \"%s\": %v", name, err)
|
||||
}
|
||||
|
||||
// Restore the IsCLIOverride flag
|
||||
intCtxEnv.IsCLIOverride = wasCLIOverride
|
||||
|
||||
newEnv = &intCtxEnv
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user