fix: skip chartify for build command jsonPatches (#2212)
The build command is intended to be a read-only inspection command that outputs the helmfile state. However, when releases use jsonPatches, strategicMergePatches, or transformers, the chart preparation step triggers chartify, which runs helm template and requires dependencies to be built. This causes two issues: 1. helm template is executed unnecessarily for a simple state inspection 2. Missing chart dependencies cause errors even with SkipDeps enabled This change modifies PrepareCharts to filter out releases that require chartify when the command is "build". These releases are excluded from chart preparation, preventing helm template from being invoked. The state output will still include these releases, but their charts won't be processed during the build operation. Signed-off-by: Shane Starcher <shanestarcher@gmail.com>
This commit is contained in:
parent
1b8f2871f6
commit
6673ebad84
|
|
@ -1139,6 +1139,16 @@ func releasesNeedCharts(releases []ReleaseSpec) []ReleaseSpec {
|
|||
return result
|
||||
}
|
||||
|
||||
func filterReleasesForBuild(releases []ReleaseSpec) []ReleaseSpec {
|
||||
var filteredReleases []ReleaseSpec
|
||||
for _, r := range releases {
|
||||
if len(r.JSONPatches) == 0 && len(r.StrategicMergePatches) == 0 && len(r.Transformers) == 0 {
|
||||
filteredReleases = append(filteredReleases, r)
|
||||
}
|
||||
}
|
||||
return filteredReleases
|
||||
}
|
||||
|
||||
type ChartPrepareOptions struct {
|
||||
ForceDownload bool
|
||||
SkipRepos bool
|
||||
|
|
@ -1237,6 +1247,12 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
|
|||
|
||||
releases := releasesNeedCharts(selected)
|
||||
|
||||
// For build command, skip releases that require chartify (jsonPatches, etc.)
|
||||
// as we only need to output state, not actually template the charts
|
||||
if helmfileCommand == "build" {
|
||||
releases = filterReleasesForBuild(releases)
|
||||
}
|
||||
|
||||
var prepareChartInfoMutex sync.Mutex
|
||||
|
||||
prepareChartInfo := make(map[PrepareChartKey]string, len(releases))
|
||||
|
|
|
|||
Loading…
Reference in New Issue