Fix redundant helm-dep-build and prepare hook regression (#1566)

Fixes #1511
Fixes #1497
This commit is contained in:
Yusuke Kuoka
2020-11-05 09:43:42 +09:00
committed by GitHub
parent 87e86dcfd2
commit bdbaa00628
2 changed files with 26 additions and 10 deletions
+16 -1
View File
@@ -855,7 +855,22 @@ type chartPrepareResult struct {
//
// If exists, it will also patch resources by json patches, strategic-merge patches, and injectors.
func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurrency int, helmfileCommand string, opts ChartPrepareOptions) (map[string]string, []error) {
releases := releasesNeedCharts(st.Releases)
var selected []ReleaseSpec
if len(st.Selectors) > 0 {
var err error
// This and releasesNeedCharts ensures that we run operations like helm-dep-build and prepare-hook calls only on
// releases that are (1) selected by the selectors and (2) to be installed.
selected, err = st.GetSelectedReleasesWithOverrides()
if err != nil {
return nil, []error{err}
}
} else {
selected = st.Releases
}
releases := releasesNeedCharts(selected)
temp := make(map[string]string, len(releases))