Merge b86b758e15 into b0911ab1a2
This commit is contained in:
commit
2657765397
|
|
@ -162,8 +162,9 @@ func (a *App) Diff(c DiffConfigProvider) error {
|
||||||
Validate: c.Validate(),
|
Validate: c.Validate(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
msg, matched, affected, errs = a.diff(run, c)
|
msg, matched, affected, errs = a.diff(run, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if msg != nil {
|
if msg != nil {
|
||||||
|
|
@ -236,8 +237,9 @@ func (a *App) Template(c TemplateConfigProvider) error {
|
||||||
Set: c.Set(),
|
Set: c.Set(),
|
||||||
Values: c.Values(),
|
Values: c.Values(),
|
||||||
KubeVersion: c.KubeVersion(),
|
KubeVersion: c.KubeVersion(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
ok, errs = a.template(run, c)
|
ok, errs = a.template(run, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if prepErr != nil {
|
if prepErr != nil {
|
||||||
|
|
@ -256,8 +258,9 @@ func (a *App) WriteValues(c WriteValuesConfigProvider) error {
|
||||||
SkipDeps: c.SkipDeps(),
|
SkipDeps: c.SkipDeps(),
|
||||||
SkipCleanup: c.SkipCleanup(),
|
SkipCleanup: c.SkipCleanup(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
ok, errs = a.writeValues(run, c)
|
ok, errs = a.writeValues(run, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if prepErr != nil {
|
if prepErr != nil {
|
||||||
|
|
@ -309,8 +312,9 @@ func (a *App) Lint(c LintConfigProvider) error {
|
||||||
SkipCleanup: c.SkipCleanup(),
|
SkipCleanup: c.SkipCleanup(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
ok, lintErrs, errs = a.lint(run, c)
|
ok, lintErrs, errs = a.lint(run, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if prepErr != nil {
|
if prepErr != nil {
|
||||||
|
|
@ -345,7 +349,8 @@ func (a *App) Fetch(c FetchConfigProvider) error {
|
||||||
OutputDir: c.OutputDir(),
|
OutputDir: c.OutputDir(),
|
||||||
OutputDirTemplate: c.OutputDirTemplate(),
|
OutputDirTemplate: c.OutputDirTemplate(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
if prepErr != nil {
|
if prepErr != nil {
|
||||||
|
|
@ -371,8 +376,9 @@ func (a *App) Sync(c SyncConfigProvider) error {
|
||||||
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
||||||
Validate: c.Validate(),
|
Validate: c.Validate(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
ok, errs = a.sync(run, c)
|
ok, errs = a.sync(run, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if prepErr != nil {
|
if prepErr != nil {
|
||||||
|
|
@ -407,7 +413,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
|
||||||
Validate: c.Validate(),
|
Validate: c.Validate(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
matched, updated, es := a.apply(run, c)
|
matched, updated, es := a.apply(run, c)
|
||||||
|
|
||||||
mut.Lock()
|
mut.Lock()
|
||||||
|
|
@ -415,6 +421,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
|
||||||
mut.Unlock()
|
mut.Unlock()
|
||||||
|
|
||||||
ok, errs = matched, es
|
ok, errs = matched, es
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if prepErr != nil {
|
if prepErr != nil {
|
||||||
|
|
@ -443,8 +450,9 @@ func (a *App) Status(c StatusesConfigProvider) error {
|
||||||
SkipRepos: true,
|
SkipRepos: true,
|
||||||
SkipDeps: true,
|
SkipDeps: true,
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
ok, errs = a.status(run, c)
|
ok, errs = a.status(run, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -465,8 +473,9 @@ func (a *App) Destroy(c DestroyConfigProvider) error {
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
DeleteWait: c.DeleteWait(),
|
DeleteWait: c.DeleteWait(),
|
||||||
DeleteTimeout: c.DeleteTimeout(),
|
DeleteTimeout: c.DeleteTimeout(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
ok, errs = a.delete(run, true, c)
|
ok, errs = a.delete(run, true, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
|
|
@ -491,8 +500,9 @@ func (a *App) Test(c TestConfigProvider) error {
|
||||||
SkipRefresh: c.SkipRefresh(),
|
SkipRefresh: c.SkipRefresh(),
|
||||||
SkipDeps: c.SkipDeps(),
|
SkipDeps: c.SkipDeps(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
}, func() {
|
}, func() []error {
|
||||||
errs = a.test(run, c)
|
errs = a.test(run, c)
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -510,11 +520,12 @@ func (a *App) PrintDAGState(c DAGConfigProvider) error {
|
||||||
SkipRepos: true,
|
SkipRepos: true,
|
||||||
SkipDeps: true,
|
SkipDeps: true,
|
||||||
Concurrency: 2,
|
Concurrency: 2,
|
||||||
}, func() {
|
}, func() []error {
|
||||||
err = a.dag(run)
|
err = a.dag(run)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
return ok, errs
|
return ok, errs
|
||||||
}, false, SetFilter(true))
|
}, false, SetFilter(true))
|
||||||
|
|
@ -526,7 +537,7 @@ func (a *App) PrintState(c StateConfigProvider) error {
|
||||||
SkipRepos: true,
|
SkipRepos: true,
|
||||||
SkipDeps: true,
|
SkipDeps: true,
|
||||||
Concurrency: 2,
|
Concurrency: 2,
|
||||||
}, func() {
|
}, func() []error {
|
||||||
if c.EmbedValues() {
|
if c.EmbedValues() {
|
||||||
for i := range run.state.Releases {
|
for i := range run.state.Releases {
|
||||||
r := run.state.Releases[i]
|
r := run.state.Releases[i]
|
||||||
|
|
@ -534,7 +545,7 @@ func (a *App) PrintState(c StateConfigProvider) error {
|
||||||
values, err := run.state.LoadYAMLForEmbedding(&r, r.Values, r.MissingFileHandler, r.ValuesPathPrefix)
|
values, err := run.state.LoadYAMLForEmbedding(&r, r.Values, r.MissingFileHandler, r.ValuesPathPrefix)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = []error{err}
|
errs = []error{err}
|
||||||
return
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
run.state.Releases[i].Values = values
|
run.state.Releases[i].Values = values
|
||||||
|
|
@ -542,7 +553,7 @@ func (a *App) PrintState(c StateConfigProvider) error {
|
||||||
secrets, err := run.state.LoadYAMLForEmbedding(&r, r.Secrets, r.MissingFileHandler, r.ValuesPathPrefix)
|
secrets, err := run.state.LoadYAMLForEmbedding(&r, r.Secrets, r.MissingFileHandler, r.ValuesPathPrefix)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = []error{err}
|
errs = []error{err}
|
||||||
return
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
run.state.Releases[i].Secrets = secrets
|
run.state.Releases[i].Secrets = secrets
|
||||||
|
|
@ -552,17 +563,18 @@ func (a *App) PrintState(c StateConfigProvider) error {
|
||||||
stateYaml, err := run.state.ToYaml()
|
stateYaml, err := run.state.ToYaml()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = []error{err}
|
errs = []error{err}
|
||||||
return
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceFile, err := run.state.FullFilePath()
|
sourceFile, err := run.state.FullFilePath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = []error{err}
|
errs = []error{err}
|
||||||
return
|
return errs
|
||||||
}
|
}
|
||||||
fmt.Printf("---\n# Source: %s\n\n%+v", sourceFile, stateYaml)
|
fmt.Printf("---\n# Source: %s\n\n%+v", sourceFile, stateYaml)
|
||||||
|
|
||||||
errs = []error{}
|
errs = []error{}
|
||||||
|
return errs
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -598,12 +610,13 @@ func (a *App) ListReleases(c ListConfigProvider) error {
|
||||||
SkipRepos: true,
|
SkipRepos: true,
|
||||||
SkipDeps: true,
|
SkipDeps: true,
|
||||||
Concurrency: 2,
|
Concurrency: 2,
|
||||||
}, func() {
|
}, func() []error {
|
||||||
rel, err := a.list(run)
|
rel, err := a.list(run)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
stateReleases = rel
|
stateReleases = rel
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
stateReleases, err = a.list(run)
|
stateReleases, err = a.list(run)
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ func (r *Run) prepareChartsIfNeeded(helmfileCommand string, dir string, concurre
|
||||||
return releaseToChart, nil
|
return releaseToChart, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepareOptions, f func()) error {
|
func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepareOptions, f func() []error) error {
|
||||||
if r.ReleaseToChart != nil {
|
if r.ReleaseToChart != nil {
|
||||||
panic("Run.PrepareCharts can be called only once")
|
panic("Run.PrepareCharts can be called only once")
|
||||||
}
|
}
|
||||||
|
|
@ -113,9 +113,13 @@ func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepare
|
||||||
|
|
||||||
r.ReleaseToChart = releaseToChart
|
r.ReleaseToChart = releaseToChart
|
||||||
|
|
||||||
f()
|
errs := f()
|
||||||
|
var firstErr error = nil
|
||||||
|
if len(errs) > 0 {
|
||||||
|
firstErr = errs[0]
|
||||||
|
}
|
||||||
|
|
||||||
_, err = r.state.TriggerGlobalCleanupEvent(helmfileCommand)
|
_, err = r.state.TriggerGlobalCleanupEvent(helmfileCommand, firstErr)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2472,8 +2472,8 @@ func (st *HelmState) TriggerGlobalPrepareEvent(helmfileCommand string) (bool, er
|
||||||
return st.triggerGlobalReleaseEvent("prepare", nil, helmfileCommand)
|
return st.triggerGlobalReleaseEvent("prepare", nil, helmfileCommand)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *HelmState) TriggerGlobalCleanupEvent(helmfileCommand string) (bool, error) {
|
func (st *HelmState) TriggerGlobalCleanupEvent(helmfileCommand string, evtErr error) (bool, error) {
|
||||||
return st.triggerGlobalReleaseEvent("cleanup", nil, helmfileCommand)
|
return st.triggerGlobalReleaseEvent("cleanup", evtErr, helmfileCommand)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *HelmState) triggerGlobalReleaseEvent(evt string, evtErr error, helmfileCmd string) (bool, error) {
|
func (st *HelmState) triggerGlobalReleaseEvent(evt string, evtErr error, helmfileCmd string) (bool, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue