Repository navigation
fix: default the version of release dependencies that omit it - #2892
Merged
yxxhero merged 1 commit intoNov 12, 2026
Merged
Conversation
Helm rejects an empty version constraint, so a release dependency without `version` failed to render. Remote charts now get "*" and local charts ">=0.0.0-0", which also accepts a prerelease local chart. An explicit version is passed through unchanged. Signed-off-by: Cayan <[email protected]>
Cayan
requested review from
aditmeno,
itscaro,
mumoshu,
xiaomudk,
yxxhero and
zhaque44
as code owners
November 11, 2026 11:48
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the dependency-version defaulting change.
No open issues 🎉
What changed in this PR
Fixes the missing dependency-version case in #1407 by supplying valid constraints before passing ad-hoc dependencies to chartify. Explicit versions remain unchanged.
Changes:
- Defaults local and go-getter dependencies to
>=0.0.0-0, allowing prereleases, and repository/OCI dependencies to*. - Adds unit tests and Helm 3/4 snapshots covering omitted versions.
- Documents the default constraints.
| File | Description |
|---|---|
test/e2e/template/helmfile/testdata/snapshot/issue_1407_adhoc_dep_without_version/output.yaml |
Expected Helm 3 rendering. |
test/e2e/template/helmfile/testdata/snapshot/issue_1407_adhoc_dep_without_version/output-helm4.yaml |
Expected Helm 4 rendering. |
test/e2e/template/helmfile/testdata/snapshot/issue_1407_adhoc_dep_without_version/input.yaml.gotmpl |
Exercises repository and local dependencies without versions. |
test/e2e/template/helmfile/testdata/snapshot/issue_1407_adhoc_dep_without_version/config.yaml |
Configures the snapshot repository and template command. |
test/e2e/template/helmfile/testdata/snapshot/issue_1407_adhoc_dep_without_version/chart/rc/templates/resources.yaml |
Renders the local dependency’s test resources. |
test/e2e/template/helmfile/testdata/snapshot/issue_1407_adhoc_dep_without_version/chart/rc/Chart.yaml |
Defines the local prerelease chart fixture. |
pkg/state/helmx.go |
Applies source-aware defaults to empty dependency versions. |
pkg/state/helmx_test.go |
Tests defaults and preservation of explicit versions. |
docs/advanced-features.md |
Explains optional versions and their defaults. |
Review effort: Balanced
yxxhero
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs show a local ad-hoc dependency without
version, buthelmfile templateon it fails:PrepareChartifypasses the emptyversionto chartify, which writes it to the generatedChart.yaml. Helm rejects an empty constraint insemver.NewConstraint(d.Version)(internal/resolver/resolver.go). The same happens for a dependency from a chart repository.This change fills in a default when
versionis empty:>=0.0.0-0for a local chart or one fetched with go-getter. Helm checks afile://dependency against the single version in itsChart.yaml. A constraint without a prerelease part does not match prereleases (Masterminds/semver), so*would still fail for a chart at1.2.3-rc.1withcan't get a valid version.*for a repository or OCI chart, so Helm picks the latest version that is not a prerelease, as chartify already does for the older string form ofdependencies.An explicit
versionreaches chartify unchanged. The dependencies section ofdocs/advanced-features.mddescribes the defaults.Tests:
TestPrepareChartify_DependencyDefaultVersioninpkg/state/helmx_test.gochecks the version chartify receives for repository, OCI, local and go-getter dependencies with and withoutversion. Onmainthe four cases withoutversionget"".issue_1407_adhoc_dep_without_versionrunshelmfile templatewith a repository dependency (myrepo/raw) and a local prerelease dependency (0.2.0-rc.1), neither withversion. It rendersraw0.1.0 and the prerelease; with themainbinary it fails with the error above. It passes with Helm v3.18.6, v3.22.1 and v4.3.1.helmfile templateon a local chart with one dependency and noversion:main1.2.3child-1.2.31.2.3-rc.1childrc-1.2.3-rc.11.2.3and1.3.0-rc.1child-1.2.3helm/helm#10096 ("Make
versionoptional for local chart dependencies") is still open, so Helm itself still needs a constraint here.Fixes the missing
versioncase reported in #1407. The issue also reports "found in Chart.yaml, but missing in charts/ directory" with an explicitversion; that does not reproduce withhelmfile templateonmain(Helm 4.2.3), and this change does not touch it.