mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 19:38:37 +02:00
Implement temp file cleanup for chartify and helmfile temp files
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
co-authored by
yxxhero
parent
3ce5abcc4f
commit
53ee477e20
+10
-2
@@ -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 function to track additional files/dirs for cleanup
|
||||
}
|
||||
|
||||
func (st *HelmState) downloadChartWithGoGetter(r *ReleaseSpec) (string, error) {
|
||||
@@ -312,6 +313,13 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp
|
||||
st.removeFiles(filesNeedCleaning)
|
||||
}
|
||||
|
||||
// Add function to track additional files/directories for cleanup
|
||||
c.AddToCleanup = func(path string) {
|
||||
filesNeedCleaning = append(filesNeedCleaning, path)
|
||||
}
|
||||
|
||||
c.Clean = clean
|
||||
|
||||
var shouldRun bool
|
||||
|
||||
dir := chart
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user