Enable --wait-for-jobs flag introduced in helm 3.5 (#1715)

Fixes #1650
Fixes #785

This change introduces:

- `--wait-for-jobs` CLI override option to helmfile binary
- `waitForJobs` helmDefaults parameter (default `false`)
- `waitForJobs` release parameter (default `false`)

Note that `--wait-for-jobs` was introduced in Helm 3.5 (https://github.com/helm/helm/pull/8363)
This commit is contained in:
Jason Witkowski
2021-03-23 16:53:57 +09:00
committed by GitHub
parent fcf9a7273f
commit 2618cfb38b
10 changed files with 85 additions and 26 deletions
+12 -8
View File
@@ -294,9 +294,10 @@ func (a *App) Lint(c LintConfigProvider) error {
func (a *App) Sync(c SyncConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
prepErr := run.withPreparedCharts("sync", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Wait: c.Wait(),
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Wait: c.Wait(),
WaitForJobs: c.WaitForJobs(),
}, func() {
ok, errs = a.sync(run, c)
})
@@ -320,9 +321,10 @@ func (a *App) Apply(c ApplyConfigProvider) error {
err := a.ForEachState(func(run *Run) (ok bool, errs []error) {
prepErr := run.withPreparedCharts("apply", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Wait: c.Wait(),
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Wait: c.Wait(),
WaitForJobs: c.WaitForJobs(),
}, func() {
matched, updated, es := a.apply(run, c)
@@ -1186,6 +1188,7 @@ Do you really want to apply?
Set: c.Set(),
SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(),
Wait: c.Wait(),
WaitForJobs: c.WaitForJobs(),
}
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), &syncOpts)
}))
@@ -1400,8 +1403,9 @@ func (a *App) sync(r *Run, c SyncConfigProvider) (bool, []error) {
subst.Releases = rs
opts := &state.SyncOpts{
Set: c.Set(),
Wait: c.Wait(),
Set: c.Set(),
Wait: c.Wait(),
WaitForJobs: c.WaitForJobs(),
}
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), opts)
}))
+6
View File
@@ -215,6 +215,7 @@ func TestVisitDesiredStatesWithReleasesFiltered_Issue1008_MissingNonDefaultEnvIn
"/path/to/base.yaml": `
helmDefaults:
wait: true
waitForJobs: true
`,
"/path/to/helmfile.yaml": `
bases:
@@ -2316,6 +2317,7 @@ type applyConfig struct {
skipDiffOnInstall bool
logger *zap.SugaredLogger
wait bool
waitForJobs bool
}
func (a applyConfig) Args() string {
@@ -2326,6 +2328,10 @@ func (a applyConfig) Wait() bool {
return a.wait
}
func (a applyConfig) WaitForJobs() bool {
return a.waitForJobs
}
func (a applyConfig) Values() []string {
return a.values
}
+2
View File
@@ -40,6 +40,7 @@ type ApplyConfigProvider interface {
Set() []string
SkipDeps() bool
Wait() bool
WaitForJobs() bool
IncludeTests() bool
@@ -67,6 +68,7 @@ type SyncConfigProvider interface {
Set() []string
SkipDeps() bool
Wait() bool
WaitForJobs() bool
concurrencyConfig
loggingConfig