Fix --skip-cleanup to work with chartify (#1860)

This commit is contained in:
Yusuke Kuoka 2021-05-24 08:30:58 +09:00 committed by GitHub
parent c881544255
commit 97bab23e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -237,6 +237,7 @@ func (a *App) Template(c TemplateConfigProvider) error {
SkipRepos: c.SkipDeps(), SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(), SkipDeps: c.SkipDeps(),
IncludeCRDs: &includeCRDs, IncludeCRDs: &includeCRDs,
SkipCleanup: c.SkipCleanup(),
}, func() { }, func() {
ok, errs = a.template(run, c) ok, errs = a.template(run, c)
}) })
@ -390,6 +391,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
Wait: c.Wait(), Wait: c.Wait(),
WaitForJobs: c.WaitForJobs(), WaitForJobs: c.WaitForJobs(),
IncludeCRDs: &includeCRDs, IncludeCRDs: &includeCRDs,
SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(),
}, func() { }, func() {
matched, updated, es := a.apply(run, c) matched, updated, es := a.apply(run, c)

View File

@ -964,6 +964,7 @@ type ChartPrepareOptions struct {
SkipRepos bool SkipRepos bool
SkipDeps bool SkipDeps bool
SkipResolve bool SkipResolve bool
SkipCleanup bool
IncludeCRDs *bool IncludeCRDs *bool
Wait bool Wait bool
WaitForJobs bool WaitForJobs bool
@ -1108,7 +1109,9 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
isLocal := st.directoryExistsAt(normalizeChart(st.basePath, chartName)) isLocal := st.directoryExistsAt(normalizeChart(st.basePath, chartName))
chartification, clean, err := st.PrepareChartify(helm, release, chartPath, workerIndex) chartification, clean, err := st.PrepareChartify(helm, release, chartPath, workerIndex)
defer clean() if !opts.SkipCleanup {
defer clean()
}
if err != nil { if err != nil {
results <- &chartPrepareResult{err: err} results <- &chartPrepareResult{err: err}
return return