Skip to content

feat: let release dependencies set their Chart.yaml condition - #2879

Merged
yxxhero merged 1 commit into
helmfile:mainfrom
Cayan:feat/dependency-condition
Nov 8, 2026
Merged

yxxhero merged 1 commit into
helmfile:mainfrom
Cayan:feat/dependency-condition

Conversation

@Cayan

@Cayan Cayan commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

An ad-hoc dependency in releases[].dependencies always gets the condition <alias or chart name>.enabled in the generated Chart.yaml, and the entry has no field to change it. Setting condition: fails to load, because the loader is strict:

yaml: unmarshal errors:
  line 8: field condition not found in type state.Dependency

So a dependency cannot be switched by a shared values path such as global.envoy.enabled.

chartify v0.30.0 (helmfile/chartify#214, already in go.mod) added ChartDependency.Condition, written to the dependency's condition and defaulting to <alias or chart name>.enabled when empty. This change adds condition to the dependency entry and passes it to chartify. An entry without condition produces the same Chart.yaml as before. The dependencies section of docs/advanced-features.md describes the field.

Test: TestPrepareChartify_DependencyCondition in pkg/state/helmx_test.go decodes a release with two dependencies, one with condition: global.bar.enabled and one without, runs PrepareChartify and checks the chartify dependencies: the first carries the condition, the second an empty one (chartify's default). It fails on main with Condition: "" where "global.bar.enabled" is expected.

helmfile template on a local chart foo with a local dependency bar, release values global.bar.enabled: false:

  • with condition: global.bar.enabled: main fails with the error above; this branch renders only foo.
  • without condition: main and this branch both render foo and bar.

Resolves #1258 (part A was helmfile/chartify#214).

An entry in a release's dependencies: list can now carry condition, which is written to
the generated Chart.yaml. Left empty, chartify keeps the default <alias or chart name>.enabled,
so helmfiles without the key render as before; before this, the strict loader rejected it.

Signed-off-by: Cayan <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the addition of configurable dependency conditions.

No open issues 🎉

What changed in this PR

Adds configurable conditions to ad-hoc release dependencies, addressing #1258 by allowing shared values paths such as global.envoy.enabled while preserving the existing default behavior.

Changes:

  • Accepts releases[].dependencies[].condition and passes it to chartify.
  • Adds a regression test covering explicit and omitted conditions.
  • Documents the new field and records it in the changelog.
File Description
pkg/​state/​helmx.go Adds the dependency condition field and forwards it to chartify.
pkg/​state/​helmx_test.go Tests YAML decoding and forwarding of explicit and omitted conditions.
docs/​advanced-features.md Explains the default condition and shows a custom values path.
CHANGELOG.md Records support for configurable dependency conditions.

Review effort: Balanced

@yxxhero
yxxhero merged commit 220faa1 into helmfile:main Nov 8, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation Discrepancy: Inconsistency in Support for 'condition' Flag in Helmfile Dependencies

3 participants