Skip to content

Array merging when using --state-values-file since 1.3.0 #2536

Description

@Moglum

Operating system

Ubuntu 24.04.4 LTS

Helmfile Version

v1.4.4

Helm Version

v4.1.4

Bug description

Up until 1.2.3, an array provided via --state-values-file completely overrides an array defined in a values file referenced in environments.default.values

Starting with 1.3.0 (including the latest 1.4.4), arrays are merged by item position, breaking the expected behavior.

Most likely related to #2367 which was implemented to fix #2353

Example helmfile.yaml

helmfile.yaml

environments:
  default:
    values:
      - values-default.yaml
---
releases:
  - name: list
    chart: ./list

list/list.yaml.gotmpl

{{- range $item := .Values.list }}
item: {{ $item }}
{{- end }}

values-default.yaml

list:
  - first
  - second

values-first.yaml

list:
  - first

values-second.yaml

list:
  - second

Behavior with version <=1.2.3

❯ helmfile template --file helmfile.yaml --state-values-file values-second.yaml
---
item: second

With version >=1.3.0

❯ helmfile template --file helmfile.yaml --state-values-file values-second.yaml
---
item: second
item: second

Error message you've seen (if any)

No error message, just wrong templating output.

Steps to reproduce

https://github.com/Moglum/helmfile-arrays

Working Helmfile Version

v1.2.3

Relevant discussion

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions