Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes helmfile build failures caused by chart preparation invoking chartify/helm operations (e.g., helm fetch / helm template) while the build flow runs with SkipRepos: true, leading to repo <repo> not found for releases that trigger chartify via dependencies or forceNamespace.
Changes:
- Refactors build-time release filtering in chart preparation to also exclude releases with
dependenciesandforceNamespace(in addition to the previously handled patch/transformer triggers). - Adds a focused unit test covering build filtering behavior across all chartify triggers relevant to issue #1859.
- Adds an app-level regression test asserting the
PrintState/ build path performs zero helm calls while still outputting the expected state content.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/state/state.go | Adds a helper predicate and extends build-time filtering so chart prep skips additional chartify-triggering releases. |
| pkg/state/issue_1859_test.go | New unit regression test validating filterReleasesForBuild behavior for all relevant triggers. |
| pkg/app/app_test.go | New regression test ensuring PrintState/build makes no helm calls when releases include deps/forceNamespace. |
| // TestPrint_WithDependencies is a regression test for issue #1859. | ||
| // `helmfile build` must not call helm fetch/pull/template for releases | ||
| // with dependencies, forceNamespace, jsonPatches, strategicMergePatches, | ||
| // or transformers, because build runs with SkipRepos: true. |
| out, err := testutil.CaptureStdout(func() { | ||
| err := app.PrintState(configImpl{}) | ||
| assert.Nil(t, err) | ||
| }) |
| // triggersChartifyRemote mirrors the conditions in PrepareChartify (helmx.go) | ||
| // that set shouldRun=true and require network access to fetch or template a | ||
| // remote chart. The build command runs with SkipRepos: true, so any release | ||
| // matching these conditions fails with "repo not found". The local-directory | ||
| // case (NeedsChartifyForLocalDir) is intentionally excluded because it | ||
| // operates on a local path and does not require remote repos. | ||
| // See issue #1859. | ||
| func triggersChartifyRemote(r ReleaseSpec) bool { |
…pace (helmfile#1859) The build command is read-only and runs with SkipRepos: true, meaning repositories are not synced. However, releases with dependencies or forceNamespace trigger chartify (PrepareChartify in helmx.go), which runs helm fetch/pull/template and requires repos — causing "repo <repo> not found" errors. PR helmfile#2212 partially addressed this by filtering releases with jsonPatches, strategicMergePatches, and transformers. This change extends the filter to also cover dependencies and forceNamespace, completing the fix for issue helmfile#1859. The filter is refactored into triggersChartifyRemote() which mirrors all conditions in PrepareChartify that set shouldRun=true and require network access. The local-directory case (NeedsChartifyForLocalDir) is excluded as it operates on local paths without needing remote repos. Signed-off-by: yxxhero <[email protected]> Signed-off-by: yxxhero <[email protected]>
…ion test Signed-off-by: yxxhero <[email protected]>
e45695a to
48cd43c
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
- Extend the chartify-trigger release filter beyond `build` to `status` and `show-dag`: these read-only commands run chart preparation with SkipRepos/SkipDeps and fail with "repo not found" on the same release shapes (dependencies, forceNamespace, patches, transformers). - Generalize naming: filterReleasesForBuild -> filterReleasesSkippingChartify, gated by the new commandsSkippingChartifyTriggers list; fix the stale call-site comment. - Add a sync note in PrepareChartify (helmx.go) next to `shouldRun` so future chartify triggers stay in sync with triggersChartifyHelmRun. - WithPreparedCharts: check map presence instead of comparing the zero value against rel.Chart, so a pre-existing ChartPath is no longer wiped for releases skipped by chart preparation. - Tests: pin the command list (TestCommandsSkippingChartifyTriggers); add end-to-end regression tests for show-dag and status; assert that build output leaks no chartPath/chartify temp paths. Signed-off-by: yxxhero <[email protected]>
Signed-off-by: yxxhero <[email protected]> # Conflicts: # pkg/app/run.go
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Summary
Fixes #1859
helmfile buildfails withrepo <repo> not foundwhen releases usedependenciesorforceNamespace. This is because build runs withSkipRepos: true(repos not synced), but these release fields trigger chartify which callshelm fetch/helm template.PR #2212 partially addressed this by filtering releases with
jsonPatches,strategicMergePatches, andtransformers. This PR completes the fix by also filteringdependenciesandforceNamespace, and extends the same fix tostatusandshow-dag, which run chart preparation with the identicalSkipRepos: true, SkipDeps: truesetup and fail on the same release shapes.Root Cause
PrintState(build),Status, andPrintDAGState(show-dag) callWithPreparedCharts(..., SkipRepos: true, SkipDeps: true). Since repos are skipped, any chartify trigger that needs remote repo access fails.In
PrepareChartify(helmx.go), 6 conditions setshouldRun = true:Dependencies(line 1038) — needs helm fetch ← was missingJSONPatches(line 1071) — covered by fix: skip chartify for build command jsonPatches #2212StrategicMergePatches(line 1085) — covered by fix: skip chartify for build command jsonPatches #2212Transformers(line 1099) — covered by fix: skip chartify for build command jsonPatches #2212ForceNamespace(line 1105) — needs helm fetch ← was missingChanges
pkg/state/state.go: AddedcommandsSkippingChartifyTriggers(build,status,show-dag). ExtractedtriggersChartifyHelmRun()helper covering all 5 network-dependent chartify triggers;filterReleasesSkippingChartify(formerlyfilterReleasesForBuild) uses it instead of inline conditions. The local-directory case is intentionally excluded (no remote repo needed).pkg/state/helmx.go: Added a sync note next toshouldRuninPrepareChartifyso future chartify triggers are kept in sync withtriggersChartifyHelmRun.pkg/app/run.go:WithPreparedChartsnow checks map presence instead of comparing the zero value""againstrel.Chart, so a pre-existingChartPathis no longer wiped for releases skipped by chart preparation.pkg/state/issue_1859_test.go: Unit test with 7 subtests covering each trigger + mixed case, plus a test pinning the command list.pkg/app/app_test.go: Integration tests (TestPrint_WithDependencies,TestStatus_WithChartifyTriggers,TestPrintDAG_WithChartifyTriggers) verifying the full build/status/show-dag flows with deps/forceNamespace/patches/plain releases — correct output,helm statusstill invoked per release, zero chart-related helm calls.Verification
E2E tested with proxy (all pass, exit 0):
helmfile templatewith deps — no regression (repos synced, chart downloaded)golangci-lint: 0 issues-race -p=1status/show-dag coverage is automated:
TestStatus_WithChartifyTriggersandTestPrintDAG_WithChartifyTriggersexercise the full flows with zero chart-related helm calls (any such call panics the mock).Example
Before:
helmfile build→Error: repo examples not foundAfter:
helmfile build→ outputs full state successfully