Skip to content

feat: add support for chart version - #1

Closed
gmenuel wants to merge 1 commit into
helmfile:masterfrom
gmenuel:feature/support-chart-version
Closed

feat: add support for chart version#1
gmenuel wants to merge 1 commit into
helmfile:masterfrom
gmenuel:feature/support-chart-version

Conversation

@gmenuel

Copy link
Copy Markdown

Currently the chart version is passed to chartify, but it isn't used when fetching the charts.

@mumoshu

Copy link
Copy Markdown
Contributor

@gmenuel Oh, wow! Thanks you so much for submitting this

Too bad I couldn't notice this before I fixed it myself...

My own change seems equivalent to yours, so I was able to double-check the correctness of my work thanks to your PR.

I'm closing this as resolved, but please feel free to report any issue/poke me for earlier review, so that this won't happen again!

Thanks again for your support ☺️

@mumoshumumoshu closed this May 29, 2020
yxxhero added a commit that referenced this pull request Aug 2, 2026
Addresses the gaps identified in review of the empty-render fix (#206):
1. replace.go: the empty-render branch no longer early-returns. It removes
the content dirs and temp output, then falls through so the Chart.yaml
`dependencies` field and Chart.lock/requirements.lock cleanup still run.
Without this, an empty-rendering chart that declares dependencies would
leave Chart.yaml referencing subcharts whose charts/ dir was removed,
causing a downstream "found in Chart.yaml, but missing in charts/
directory" error. Also fixes %v -> %w wrapping and adds path context.
2. chartify.go: skip the kustomize Patch step when no resources were
rendered (`len(generatedManifestFiles) == 0`). Previously an empty render
combined with JsonPatches/StrategicMergePatches/Transformers fed kustomize
an empty resource list plus patches, failing with "no resource matches
strategic merge patch ...". An empty render is now a no-op success even
when patches are configured (there is simply nothing to patch).
Tests:
- TestEmptyRenderCleansChartDependencies: verifies a chart that declares a
dependency and renders nothing still produces a chartifiable output whose
Chart.yaml has no dependencies and templates empty. Proven to fail without
fix#1.
- integration "empty render with patch": exercises the StrategicMergePatches
path on the empty chart; proven to fail without fix#2.
- testdata/chart_patch/configmap.emptychart.strategic.yaml + empty snapshot.
yxxhero added a commit that referenced this pull request Aug 2, 2026
Addresses the gaps identified in review of the empty-render fix (#206):
1. replace.go: the empty-render branch no longer early-returns. It removes
the content dirs and temp output, then falls through so the Chart.yaml
`dependencies` field and Chart.lock/requirements.lock cleanup still run.
Without this, an empty-rendering chart that declares dependencies would
leave Chart.yaml referencing subcharts whose charts/ dir was removed,
causing a downstream "found in Chart.yaml, but missing in charts/
directory" error. Also fixes %v -> %w wrapping and adds path context.
2. chartify.go: skip the kustomize Patch step when no resources were
rendered (`len(generatedManifestFiles) == 0`). Previously an empty render
combined with JsonPatches/StrategicMergePatches/Transformers fed kustomize
an empty resource list plus patches, failing with "no resource matches
strategic merge patch ...". An empty render is now a no-op success even
when patches are configured (there is simply nothing to patch).
Tests:
- TestEmptyRenderCleansChartDependencies: verifies a chart that declares a
dependency and renders nothing still produces a chartifiable output whose
Chart.yaml has no dependencies and templates empty. Proven to fail without
fix#1.
- integration "empty render with patch": exercises the StrategicMergePatches
path on the empty chart; proven to fail without fix#2.
- testdata/chart_patch/configmap.emptychart.strategic.yaml + empty snapshot.
Signed-off-by: yxxhero <aiopsclub@163.com>
yxxhero added a commit that referenced this pull request Aug 2, 2026
* Initial plan
* Fix empty render crash: treat no-output helm template as no-op
When helm template --output-dir produces an empty directory (e.g. all
templates are gated behind a falsy conditional), ReplaceWithRendered
now removes the chart's content dirs and returns successfully with an
empty file list instead of crashing with an assertion error.
Adds test chart testdata/charts/emptychart and integration test
'empty render no op' to cover this scenario.
Closes#206
* Complete the empty-render fix: clean deps, skip kustomize, harden tests
Addresses the gaps identified in review of the empty-render fix (#206):
1. replace.go: the empty-render branch no longer early-returns. It removes
the content dirs and temp output, then falls through so the Chart.yaml
`dependencies` field and Chart.lock/requirements.lock cleanup still run.
Without this, an empty-rendering chart that declares dependencies would
leave Chart.yaml referencing subcharts whose charts/ dir was removed,
causing a downstream "found in Chart.yaml, but missing in charts/
directory" error. Also fixes %v -> %w wrapping and adds path context.
2. chartify.go: skip the kustomize Patch step when no resources were
rendered (`len(generatedManifestFiles) == 0`). Previously an empty render
combined with JsonPatches/StrategicMergePatches/Transformers fed kustomize
an empty resource list plus patches, failing with "no resource matches
strategic merge patch ...". An empty render is now a no-op success even
when patches are configured (there is simply nothing to patch).
Tests:
- TestEmptyRenderCleansChartDependencies: verifies a chart that declares a
dependency and renders nothing still produces a chartifiable output whose
Chart.yaml has no dependencies and templates empty. Proven to fail without
fix#1.
- integration "empty render with patch": exercises the StrategicMergePatches
path on the empty chart; proven to fail without fix#2.
- testdata/chart_patch/configmap.emptychart.strategic.yaml + empty snapshot.
Signed-off-by: yxxhero <aiopsclub@163.com>
* Address review: use unversioned `go test` in example commands
The SAVE_SNAPSHOT example comments used `go1.25 test`, but this repo's
go.mod requires Go 1.26.0+, so `go1.25 test` would fail. Switch to the
unversioned `go test` (reviewer's preferred form) on the two empty-render
test cases flagged in review.
Signed-off-by: yxxhero <aiopsclub@163.com>
---------
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
Sign up for freeto 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.

2 participants

@gmenuel@mumoshu