Compare commits

...
2 changed files with 20 additions and 8 deletions
+16 -8
View File
@@ -249,8 +249,9 @@ func (st *HelmState) appendShowOnlyFlags(flags []string, showOnly []string) []st
}
type Chartify struct {
Opts *chartify.ChartifyOpts
Clean func()
Opts *chartify.ChartifyOpts
Clean func()
AddToCleanup func(string) // Add a path to be cleaned up
}
func (st *HelmState) downloadChartWithGoGetter(r *ReleaseSpec) (string, error) {
@@ -296,6 +297,16 @@ func (st *HelmState) goGetterChart(chart, dir, cacheDir string, force bool) (str
}
func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSpec, chart string, workerIndex int) (*Chartify, func(), error) {
var filesNeedCleaning []string
clean := func() {
st.removeFiles(filesNeedCleaning)
}
addToCleanup := func(path string) {
filesNeedCleaning = append(filesNeedCleaning, path)
}
c := &Chartify{
Opts: &chartify.ChartifyOpts{
WorkaroundOutputDirIssue: true,
@@ -304,12 +315,7 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp
Namespace: release.Namespace,
ID: ReleaseToID(release),
},
}
var filesNeedCleaning []string
clean := func() {
st.removeFiles(filesNeedCleaning)
AddToCleanup: addToCleanup,
}
var shouldRun bool
@@ -413,9 +419,11 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp
c.Opts.SetFlags = setFlags
c.Opts.TemplateData = st.newReleaseTemplateData(release)
c.Opts.TemplateFuncs = st.newReleaseTemplateFuncMap(dir)
c.Clean = clean
return c, clean, nil
}
c.Clean = clean
return nil, clean, nil
}
+4
View File
@@ -1342,6 +1342,10 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
return
} else {
chartPath = out
// Track the chartify output directory for cleanup
if chartification != nil && chartification.AddToCleanup != nil {
chartification.AddToCleanup(out)
}
}
// Skip `helm dep build` and `helm dep up` altogether when the chart is from remote or the dep is