fix: clean up stale templates dir on re-runs in Helm 3 post-renderer workaround
Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/f6c66284-8eca-4db3-8711-c9b6d3a9c179 Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
parent
b20b6b5f14
commit
ab16605fa8
|
|
@ -695,6 +695,11 @@ func (helm *execer) TemplateRelease(name string, chart string, flags ...string)
|
|||
return fmt.Errorf("failed to remove legacy output file %s: %w", legacyOutputPath, removeErr)
|
||||
}
|
||||
|
||||
// Clean up any stale files from previous runs before writing new output.
|
||||
if removeErr := os.RemoveAll(templatesDir); removeErr != nil {
|
||||
return fmt.Errorf("failed to remove stale templates directory %s: %w", templatesDir, removeErr)
|
||||
}
|
||||
|
||||
if len(out) > 0 {
|
||||
if mkdirErr := os.MkdirAll(templatesDir, 0755); mkdirErr != nil {
|
||||
return fmt.Errorf("failed to create templates directory %s: %w", templatesDir, mkdirErr)
|
||||
|
|
|
|||
Loading…
Reference in New Issue