Fix redundant helm-dep-build and prepare hook regression (#1566)
Fixes #1511 Fixes #1497
This commit is contained in:
parent
87e86dcfd2
commit
bdbaa00628
|
|
@ -2237,9 +2237,14 @@ services:
|
||||||
}
|
}
|
||||||
|
|
||||||
type configImpl struct {
|
type configImpl struct {
|
||||||
set []string
|
selectors []string
|
||||||
output string
|
set []string
|
||||||
skipDeps bool
|
output string
|
||||||
|
skipDeps bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a configImpl) Selectors() []string {
|
||||||
|
return a.selectors
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c configImpl) Set() []string {
|
func (c configImpl) Set() []string {
|
||||||
|
|
@ -4160,12 +4165,8 @@ releases:
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
expected := "[" +
|
expected := `[{"name":"myrelease1","namespace":"","enabled":false,"labels":"id:myrelease1"},{"name":"myrelease2","namespace":"","enabled":true,"labels":""},{"name":"myrelease3","namespace":"","enabled":true,"labels":""},{"name":"myrelease4","namespace":"","enabled":true,"labels":"id:myrelease1"}]
|
||||||
"{\"name\":\"myrelease1\",\"namespace\":\"\",\"enabled\":false,\"labels\":\"id:myrelease1\"}," +
|
`
|
||||||
"{\"name\":\"myrelease2\",\"namespace\":\"\",\"enabled\":true,\"labels\":\"\"}," +
|
|
||||||
"{\"name\":\"myrelease3\",\"namespace\":\"\",\"enabled\":true,\"labels\":\"\"}," +
|
|
||||||
"{\"name\":\"myrelease4\",\"namespace\":\"\",\"enabled\":true,\"labels\":\"id:myrelease1\"}" +
|
|
||||||
"]\n"
|
|
||||||
assert.Equal(t, expected, out)
|
assert.Equal(t, expected, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -855,7 +855,22 @@ type chartPrepareResult struct {
|
||||||
//
|
//
|
||||||
// If exists, it will also patch resources by json patches, strategic-merge patches, and injectors.
|
// 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) {
|
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))
|
temp := make(map[string]string, len(releases))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue