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:
copilot-swe-agent[bot]
2025-08-23 03:07:04 +00:00
co-authored by yxxhero
parent 3ce5abcc4f
commit 53ee477e20
5 changed files with 59 additions and 2 deletions
+10 -2
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 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
+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