Repository navigation
fix: skip chartification when chart renders zero resources - #2724
Conversation
When a chart's templates render zero resources (e.g. everything is
gated behind a falsy `{{- if .Values.enabled }}`) and the release has
transformers, jsonPatches, or strategicMergePatches configured,
helmfile crashed with:
assertion failed: unexpected dir entry "" it must be the abs path
to the output directory
Root cause: chartify's replace.go runs `helm template --output-dir`
and expects exactly one directory entry under that output dir (the
rendered chart). When helm renders no resources, the output dir is
empty, so chartOutputDir stays "" and chartify's own assertion on it
being an absolute path fails. chartify (v0.28.0) doesn't expose a
typed/sentinel error for this, only the assertion text.
Since there's nothing to chartify when a release has no rendered
resources, treat this specific chartify failure as a no-op: keep
using the chart as-is and let helm template it normally (producing
the same empty output helm would have produced without chartify).
Any other chartify error is still surfaced unchanged.
Verified manually end-to-end with a real helm+kustomize:
- a chart with `enabled: false` + a transformer now runs without
error instead of crashing
- a chart with `enabled: true` + the same transformer still gets
transformed correctly (annotations applied), confirming the normal
chartify path is untouched
Added unit tests for the new error-matching helper in
pkg/state/issue_1757_test.go.
Fixes #1757
Signed-off-by: ankit090701 <[email protected]>
|
Thanks for this — clean, well-scoped fix for #1757. I verified the core approach and have one blocking issue plus a few smaller notes. What I verified
🔴 Blocking — the no-op path can return a temp dir that's deleted by a deferred cleanup
if st.fs.DirectoryExistsAt(chartPath) {
rewrittenPath, cleanupTempChart, err := st.rewriteChartDependencies(chartPath)
...
chartPath = rewrittenPath // <-- chartPath is now a TEMP dir
defer cleanupTempChart() // <-- which gets RemoveAll'd on return
}
...
out, err := c.Chartify(...)
if err != nil {
if isChartifyEmptyRenderOutputError(err) {
...
return chartPath, !skipDeps, nil // ⚠️ returns the temp dir
}
return "", false, err
}
chartPath = out // success path is safe: chartPath is reassigned to chartify's own outputOn the success path this is fine — Trigger conditions: a local chart directory whose Suggested fixReturn the original (pre-rewrite) path, which is correct because the rewrite only exists to accommodate chartify's temp dir; without chartify, relative func (st *HelmState) processChartification(...) (string, bool, error) {
originalChartPath := chartPath
if st.fs.DirectoryExistsAt(chartPath) {
rewrittenPath, cleanupTempChart, err := st.rewriteChartDependencies(chartPath)
if err != nil {
return "", false, fmt.Errorf("failed to rewrite chart dependencies: %w", err)
}
chartPath = rewrittenPath
defer cleanupTempChart()
}
...
out, err := c.Chartify(release.Name, chartPath, chartify.WithChartifyOpts(chartifyOpts))
// Early-return the specific empty-render case — avoids nesting under `if err != nil`.
if err != nil && isChartifyEmptyRenderOutputError(err) {
st.logger.Debugf("release %q: chart rendered no resources, skipping chartification: %v", release.Name, err)
// Return the original path, NOT the deps-rewritten temp copy (the deferred
// cleanup would remove it). Relative file:// deps resolve from the original
// location since chartify is not involved.
return originalChartPath, !skipDeps, nil
}
if err != nil {
return "", false, err
}
chartPath = out
...
}This works for both local (already normalized to absolute by the caller) and remote charts (where the rewrite block is skipped and 🟡 Minor
VerdictThe core idea is correct and the error matching is verified sound against chartify v0.28.0. The no-op return path has a real correctness bug (returning a temp dir that the deferred cleanup deletes) that I'd want fixed before merge, and the nested |
|
Follow-up on the upstream-tracking point: opened helmfile/chartify#206 — |
…-rewrite temp copy Review feedback on the original fix (#2724) found a real bug: the empty-render no-op path returned chartPath after it may have already been reassigned to the temp copy created by rewriteChartDependencies (for charts with relative file:// deps). That temp dir is removed by a deferred cleanupTempChart() as soon as processChartification returns, so the caller was handed a path to a directory that no longer existed, breaking any subsequent helm command with "chart not found" - narrow (only local charts with relative file:// deps that also render zero resources) but real and reproducible. Capture originalChartPath before the rewrite and return that instead. Also flatten the nested `if err != nil { if isChartifyEmptyRenderOutputError...` into two sequential checks per review, and link the upstream tracking issue (helmfile/chartify#206, opened by a maintainer during review) in the error-matching constant's doc comment. Added TestProcessChartification_EmptyRenderReturnsSurvivingPath, an end-to-end test exercising the real processChartification -> chartify.Chartify wiring (not just the isChartifyEmptyRenderOutputError helper) with a chart that has a relative file:// dependency and renders zero resources - the exact conditions that trigger the bug. Verified passing against real helm+kustomize in a Linux container; skipped on Windows due to an unrelated, pre-existing Windows path-handling issue in chartify's dependency resolution (a drive letter embedded in a file:// URL gets mis-joined), independent of the code path under test. Signed-off-by: ankit090701 <[email protected]>
|
Thanks for the thorough review, @yxxhero — you're right, that was a real bug. Pushed a fix:
Merged in a trivial upstream |
There was a problem hiding this comment.
Pull request overview
Fixes a helmfile crash when chartify is invoked (via transformers/jsonPatches/strategicMergePatches) on charts that render zero resources, by detecting the specific chartify assertion error and treating it as a no-op.
Changes:
- Add a no-op fallback path in
processChartificationwhen chartify fails due to empty rendered output, returning a surviving chart path. - Introduce
isChartifyEmptyRenderOutputErrorhelper (string match) to identify the empty-render chartify assertion. - Add unit/regression tests covering the helper and an end-to-end path-survival scenario.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/state/state.go | Adds empty-render chartify error detection and no-op fallback behavior in chartification flow. |
| pkg/state/issue_1757_test.go | Adds tests for the new helper and a regression test around the returned chart path’s lifetime. |
| // Tracked upstream at https://github.com/helmfile/chartify/issues/206 - once chartify | ||
| // exposes a sentinel error (or treats an empty render as a no-op itself) and this repo | ||
| // bumps to that version, this text match can be retired. | ||
| const chartifyEmptyRenderOutputErrSubstring = "it must be the abs path to the output directory" |
There was a problem hiding this comment.
Good catch, applied — verified against the actual chartify v0.28.0 source that chartOutputDir is formatted with %q, so the empty-render case produces exactly unexpected dir entry "" it must be.... Narrowed the constant to include that prefix, and added a test case asserting the same assertion text with a non-empty dir entry is correctly not matched. Re-ran the full suite including the real helm+kustomize integration test in a Linux container to confirm the narrower match still catches the actual bug.
Per Copilot's automated review on this PR: the previous substring, "it must be the abs path to the output directory", matches chartify's assertion regardless of what chartOutputDir actually is. In the real empty-render case chartOutputDir is "" (formatted via %q as `""`), but the same assertion (chartify replace.go:151) would also fire if chartOutputDir were ever a non-empty-but-still-relative path - a different, genuine bug that should be surfaced as an error, not silently treated as an empty-render no-op. Narrow the match to include the `unexpected dir entry ""` prefix, so it can only match the exact empty-string case. Verified against the actual chartify v0.28.0 source (fmt.Errorf with %q on chartOutputDir) that this is precisely what the empty-render case produces. Added a test case asserting the same assertion text with a non-empty dir entry is correctly NOT treated as the empty-render case. Re-ran the full test suite (including the real helm+kustomize end-to-end integration test) in a Linux container to confirm the narrower match still catches the actual reported bug. Signed-off-by: ankit090701 <[email protected]>
…atively (#2747) Bump github.com/helmfile/chartify to v0.28.2, which fixes the empty-render crash upstream (helmfile/chartify#206, fixed in helmfile/chartify#207): when a chart renders zero resources, chartify now treats it as a no-op success itself - removing the chart's content dirs, cleaning Chart.yaml dependencies and the lock file, and skipping the kustomize step - instead of failing with: assertion failed: unexpected dir entry "" it must be the abs path to the output directory That makes the helmfile-side string-matching workaround from #2724 dead code: the error it matched can no longer be produced. Remove isChartifyEmptyRenderOutputError and the special-cased no-op branch in processChartification, so the empty-render case simply flows through the regular chartify path. Also bump github.com/helmfile/vals to v0.46.0 and refresh transitive dependencies. The regression test for #1757 is updated to assert the new direct behavior: processChartification succeeds, returns a chartified chart whose Chart.yaml no longer declares dependencies (so a subsequent "helm dep build"/"helm template" cannot fail with "found in Chart.yaml, but missing in charts/ directory"), renders empty output, and is cleaned up by CleanupChartifyTempDirs. Fixes #1757 (follow-up to #2724) Signed-off-by: yxxhero <[email protected]>
…278) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [aqua:helmfile/helmfile](https://github.com/helmfile/helmfile) | tools | patch | `1.7.0` → `1.7.4` | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/141) for more information. --- ### Release Notes <details> <summary>helmfile/helmfile (aqua:helmfile/helmfile)</summary> ### [`v1.7.4`](https://github.com/helmfile/helmfile/releases/tag/v1.7.4) [Compare Source](helmfile/helmfile@v1.7.3...v1.7.4) #### What's Changed - build(deps): bump github.com/sashabaranov/go-openai from 1.41.2 to 1.42.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2735](helmfile/helmfile#2735) - build(deps): bump gitpython from 3.1.57 to 3.1.58 in /docs by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2737](helmfile/helmfile#2737) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.106.3 to 1.106.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2736](helmfile/helmfile#2736) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.106.4 to 1.107.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2740](helmfile/helmfile#2740) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.34 to 1.32.35 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2739](helmfile/helmfile#2739) - fix([#​2741](helmfile/helmfile#2741)): prefetch shared remote charts instead of serializing sync by [@​toms-place](https://github.com/toms-place) in [#​2743](helmfile/helmfile#2743) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.107.0 to 1.107.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2744](helmfile/helmfile#2744) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.35 to 1.32.36 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2745](helmfile/helmfile#2745) - Bumping Helm versions to 3.21.4 and 4.2.4 by [@​yxxhero](https://github.com/yxxhero) with [@​Copilot](https://github.com/Copilot) in [#​2746](helmfile/helmfile#2746) - refactor: drop empty-render workaround now that chartify handles it natively by [@​yxxhero](https://github.com/yxxhero) in [#​2747](helmfile/helmfile#2747) #### New Contributors - [@​toms-place](https://github.com/toms-place) made their first contribution in [#​2743](helmfile/helmfile#2743) **Full Changelog**: <helmfile/helmfile@v1.7.3...v1.7.4> ### [`v1.7.3`](https://github.com/helmfile/helmfile/releases/tag/v1.7.3) [Compare Source](helmfile/helmfile@v1.7.2...v1.7.3) #### What's Changed - build(deps): bump docker/login-action from 4 to 4.5.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2723](helmfile/helmfile#2723) - fix: skip chartification when chart renders zero resources by [@​ankit090701](https://github.com/ankit090701) in [#​2724](helmfile/helmfile#2724) - feat: add --skip-diff-validation-on-install CLI flag by [@​henrichter-sap](https://github.com/henrichter-sap) in [#​2728](helmfile/helmfile#2728) - bump helm-diff to v3.15.11 by [@​yxxhero](https://github.com/yxxhero) with [@​Copilot](https://github.com/Copilot) in [#​2725](helmfile/helmfile#2725) - fix: update helm plugins via uninstall+reinstall to honor pinned version by [@​yxxhero](https://github.com/yxxhero) in [#​2727](helmfile/helmfile#2727) - build(deps): bump docker/login-action from 4.5.2 to 4.6.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2729](helmfile/helmfile#2729) - build(deps): bump gitpython from 3.1.54 to 3.1.57 in /docs by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2730](helmfile/helmfile#2730) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.106.2 to 1.106.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2731](helmfile/helmfile#2731) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.31 to 1.32.34 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2732](helmfile/helmfile#2732) - build(deps): bump github.com/helmfile/chartify from v0.28.0 to v0.28.1 by [@​yxxhero](https://github.com/yxxhero) in [#​2733](helmfile/helmfile#2733) #### New Contributors - [@​ankit090701](https://github.com/ankit090701) made their first contribution in [#​2724](helmfile/helmfile#2724) - [@​henrichter-sap](https://github.com/henrichter-sap) made their first contribution in [#​2728](helmfile/helmfile#2728) **Full Changelog**: <helmfile/helmfile@v1.7.2...v1.7.3> ### [`v1.7.2`](https://github.com/helmfile/helmfile/releases/tag/v1.7.2) [Compare Source](helmfile/helmfile@v1.7.1...v1.7.2) #### What's Changed - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.105.1 to 1.105.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2707](helmfile/helmfile#2707) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.30 to 1.32.31 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2708](helmfile/helmfile#2708) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.105.2 to 1.106.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2709](helmfile/helmfile#2709) - build(deps): bump google.golang.org/grpc from 1.82.0 to 1.82.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2711](helmfile/helmfile#2711) - build(deps): bump gitpython from 3.1.50 to 3.1.52 in /docs by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2710](helmfile/helmfile#2710) - feat: add --repo-retries for helm repo and registry login commands by [@​yxxhero](https://github.com/yxxhero) in [#​2683](helmfile/helmfile#2683) - build(deps): bump github.com/helmfile/vals from 0.44.5 to 0.45.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2713](helmfile/helmfile#2713) - build(deps): bump github.com/mattn/go-runewidth from 0.0.24 to 0.0.27 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2714](helmfile/helmfile#2714) - build(deps): bump gitpython from 3.1.52 to 3.1.54 in /docs by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2715](helmfile/helmfile#2715) - build(deps): bump go.yaml.in/yaml/v3 from 3.0.4 to 3.0.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2716](helmfile/helmfile#2716) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.106.0 to 1.106.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2719](helmfile/helmfile#2719) - feat: support Helm 4 --rollback-on-failure alongside deprecated --atomic by [@​yxxhero](https://github.com/yxxhero) in [#​2722](helmfile/helmfile#2722) **Full Changelog**: <helmfile/helmfile@v1.7.1...v1.7.2> ### [`v1.7.1`](https://github.com/helmfile/helmfile/releases/tag/v1.7.1) [Compare Source](helmfile/helmfile@v1.7.0...v1.7.1) #### What's Changed - build(deps): bump github.com/zclconf/go-cty from 1.18.1 to 1.19.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2692](helmfile/helmfile#2692) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.27 to 1.32.28 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2693](helmfile/helmfile#2693) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.104.2 to 1.105.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2694](helmfile/helmfile#2694) - build(deps): bump golang.org/x/sync from 0.21.0 to 0.22.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2695](helmfile/helmfile#2695) - build(deps): bump golang.org/x/term from 0.44.0 to 0.45.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2696](helmfile/helmfile#2696) - chore: bump helm to v4.2.3 and v3.21.3 by [@​yxxhero](https://github.com/yxxhero) in [#​2699](helmfile/helmfile#2699) - feat: center section divider to match table width by [@​yxxhero](https://github.com/yxxhero) in [#​2698](helmfile/helmfile#2698) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.28 to 1.32.29 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2697](helmfile/helmfile#2697) - build(deps): bump github.com/mattn/go-runewidth from 0.0.19 to 0.0.24 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2700](helmfile/helmfile#2700) - docs: add OCI auth troubleshooting by [@​dashitongzhi](https://github.com/dashitongzhi) in [#​2679](helmfile/helmfile#2679) - fix: ensure OCI registry login when SkipRepos is set by [@​yxxhero](https://github.com/yxxhero) in [#​2701](helmfile/helmfile#2701) - build(deps): bump github.com/helmfile/chartify from 0.27.0 to 0.28.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2702](helmfile/helmfile#2702) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.105.0 to 1.105.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2703](helmfile/helmfile#2703) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.29 to 1.32.30 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2704](helmfile/helmfile#2704) - feat: support disabling hooks by [@​fabiobaiao](https://github.com/fabiobaiao) in [#​2691](helmfile/helmfile#2691) - build(deps): bump github.com/helmfile/vals from 0.44.4 to 0.44.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2706](helmfile/helmfile#2706) - build(deps): bump actions/setup-go from 6 to 7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2705](helmfile/helmfile#2705) - feat: support disabling insecure template functions only by [@​fabiobaiao](https://github.com/fabiobaiao) in [#​2689](helmfile/helmfile#2689) #### New Contributors - [@​dashitongzhi](https://github.com/dashitongzhi) made their first contribution in [#​2679](helmfile/helmfile#2679) - [@​fabiobaiao](https://github.com/fabiobaiao) made their first contribution in [#​2691](helmfile/helmfile#2691) **Full Changelog**: <helmfile/helmfile@v1.7.0...v1.7.1> </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/London) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNjAuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjQ2LjUiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbInR5cGUvcGF0Y2giXX0=--> Reviewed-on: https://forgejo.hayden.moe/hayden/phoebe/pulls/278
helmfile 1.7.3 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * build(deps): bump docker/login-action from 4 to 4.5.2 by @dependabot[bot] in helmfile/helmfile#2723 * fix: skip chartification when chart renders zero resources by @ankit090701 in helmfile/helmfile#2724 * feat: add --skip-diff-validation-on-install CLI flag by @henrichter-sap in helmfile/helmfile#2728 * bump helm-diff to v3.15.11 by @yxxhero with @Copilot in helmfile/helmfile#2725 * fix: update helm plugins via uninstall+reinstall to honor pinned version by @yxxhero in helmfile/helmfile#2727 * build(deps): bump docker/login-action from 4.5.2 to 4.6.0 by @dependabot[bot] in helmfile/helmfile#2729 * build(deps): bump gitpython from 3.1.54 to 3.1.57 in /docs by @dependabot[bot] in helmfile/helmfile#2730 * build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.106.2 to 1.106.3 by @dependabot[bot] in helmfile/helmfile#2731 * build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.32.31 to 1.32.34 by @dependabot[bot] in helmfile/helmfile#2732 * build(deps): bump github.com/helmfile/chartify from v0.28.0 to v0.28.1 by @yxxhero in helmfile/helmfile#2733 ## New Contributors * @ankit090701 made their first contribution in helmfile/helmfile#2724 * @henrichter-sap made their first contribution in helmfile/helmfile#2728 **Full Changelog**: https://github.com/helmfile/helmfile/compare/v1.7.2...v1.7.3</pre> <p>View the full release notes at <a href="https://github.com/helmfile/helmfile/releases/tag/v1.7.3">https://github.com/helmfile/helmfile/releases/tag/v1.7.3</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!15871
Summary
Helmfile crashes when a release has
transformers,jsonPatches, orstrategicMergePatchesconfigured and its chart renders zero resources (e.g. everything gated behind a falsy{{- if .Values.enabled }}):Root cause
processChartificationinpkg/state/state.gocalls intogithub.com/helmfile/chartify, which runshelm template --output-dir <dir>and then expects to find exactly one directory entry under<dir>(the rendered chart's output). Seereplace.goin chartify v0.28.0 (the version this repo currently depends on).When the chart renders zero resources,
helm template --output-dirproduces an empty directory, so the loop over directory entries never runs,chartOutputDiris left as"", and chartify's ownfilepath.IsAbs(chartOutputDir)assertion fails on that empty string. chartify doesn't expose a typed/sentinel error for this specific case, so this is only observable by matching on the assertion text.Fix
Since there's nothing to chartify when a chart renders no resources, treat this specific chartify error as a no-op: fall back to using the (already dependency-rewritten) chart path as-is, exactly like the non-chartified local-chart path already does (
buildDeps = !skipDeps, matching the existing convention at theprocessLocalChartcall site).helm template/upgrade/etc. then run against the original chart directly, producing the same empty output helm would have produced without chartify involved at all. Any other chartify error continues to be surfaced unchanged — only this specific, distinctive assertion message is matched.I deliberately didn't try to fix this in
chartifyitself, even though that's arguably the more "proper" root-cause location, since a fix there wouldn't take effect here until a new chartify version is released and this repo'sgo.modis bumped to it — this change gets a working fix out now, entirely within this repo.Prior art
There was an earlier attempt at this exact fix in #2306, which took a similar approach (catching the chartify error and no-op'ing) but went stale waiting on a DCO sign-off from the contributor and was closed by stale-bot — it was never actually rejected on technical grounds. This PR is a fresh implementation (smaller diff, reuses the existing
!skipDepsconvention forbuildDeps, adds a dedicated helper function with its own unit tests), signed off perCONTRIBUTING.md.Test plan
go build ./...pkg/state/issue_1757_test.gowith unit tests for the newisChartifyEmptyRenderOutputErrorhelper: matches chartify's specific empty-output assertion, does not match chartify's distinct "more than one dir entry" assertion, an unrelatedkustomize not founderror, or a generic helm template error.go test ./pkg/state/...passes (pre-existing unrelated failures on my Windows dev box inTestLocalChartWithTransformersPathNormalization/TestChartPathNormalizationBeforeChartificationreproduce identically on unmodifiedmainviagit stash, confirmed unrelated to this change — looks like anormalizeChartWindows path-separator issue)helm+kustomizebinaries, using a local chart with{{- if .Values.enabled }}gating all templates and anAnnotationsTransformerconfigured:enabled: false→ previously crashed with the assertion error; nowhelmfile templateexits 0, logschart rendered no resources, skipping chartification, and renders the (empty) chart normallyenabled: true→ still correctly applies the transformer (verified the annotation shows up in the rendered output), confirming the normal chartify path is unaffected by this changeFixes #1757