Skip to content

Commit

Permalink
clean helm dir before writing
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig O'Donnell committed Sep 26, 2023
1 parent bc8004b commit 422168f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/apparchive/helm-v1beta2.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ type WriteV1Beta2HelmChartsOptions struct {

// WriteV1Beta2HelmCharts copies the upstream helm chart archive and rendered values to the helm directory and processes online images (if necessary)
func WriteV1Beta2HelmCharts(opts WriteV1Beta2HelmChartsOptions) error {
// clear the previous helm dir before writing
helmDir := opts.Upstream.GetHelmDir(opts.WriteUpstreamOptions)
os.RemoveAll(helmDir)

if opts.KotsKinds == nil || opts.KotsKinds.V1Beta2HelmCharts == nil {
return nil
}
Expand All @@ -91,7 +95,7 @@ func WriteV1Beta2HelmCharts(opts WriteV1Beta2HelmChartsOptions) error {
}
}

chartDir := path.Join(opts.Upstream.GetHelmDir(opts.WriteUpstreamOptions), helmChart.GetDirName())
chartDir := path.Join(helmDir, helmChart.GetDirName())
if err := os.MkdirAll(chartDir, 0744); err != nil {
return errors.Wrap(err, "failed to create chart dir")
}
Expand Down

0 comments on commit 422168f

Please sign in to comment.