Merge b46b26860a into ee4be4e342
This commit is contained in:
commit
ba64e6cfef
|
|
@ -162,7 +162,7 @@ func (a *App) Diff(c DiffConfigProvider) error {
|
|||
|
||||
includeCRDs := !c.SkipCRDs()
|
||||
|
||||
prepErr := run.withPreparedCharts("diff", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("diff", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
|
|
@ -233,7 +233,7 @@ func (a *App) Template(c TemplateConfigProvider) error {
|
|||
// https://github.com/helmfile/helmfile/issues/1749
|
||||
run.helm.SetExtraArgs()
|
||||
|
||||
prepErr := run.withPreparedCharts("template", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("template", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
|
|
@ -261,7 +261,7 @@ func (a *App) Template(c TemplateConfigProvider) error {
|
|||
|
||||
func (a *App) WriteValues(c WriteValuesConfigProvider) error {
|
||||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
prepErr := run.withPreparedCharts("write-values", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("write-values", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
|
|
@ -313,7 +313,7 @@ func (a *App) Lint(c LintConfigProvider) error {
|
|||
var lintErrs []error
|
||||
|
||||
// `helm lint` on helm v2 and v3 does not support remote charts, that we need to set `forceDownload=true` here
|
||||
prepErr := run.withPreparedCharts("lint", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("lint", state.ChartPrepareOptions{
|
||||
ForceDownload: true,
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
|
|
@ -355,7 +355,7 @@ func (a *App) Unittest(c UnittestConfigProvider) error {
|
|||
var unittestErrs []error
|
||||
|
||||
// helm unittest needs local charts, so force download
|
||||
prepErr := run.withPreparedCharts("unittest", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("unittest", state.ChartPrepareOptions{
|
||||
ForceDownload: true,
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
|
|
@ -392,7 +392,7 @@ func (a *App) Unittest(c UnittestConfigProvider) error {
|
|||
|
||||
func (a *App) Fetch(c FetchConfigProvider) error {
|
||||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
prepErr := run.withPreparedCharts("pull", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("pull", state.ChartPrepareOptions{
|
||||
ForceDownload: true,
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
|
|
@ -416,7 +416,7 @@ func (a *App) Sync(c SyncConfigProvider) error {
|
|||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
includeCRDs := !c.SkipCRDs()
|
||||
|
||||
prepErr := run.withPreparedCharts("sync", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("sync", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
|
|
@ -428,7 +428,7 @@ func (a *App) Sync(c SyncConfigProvider) error {
|
|||
Validate: c.Validate(),
|
||||
Concurrency: c.Concurrency(),
|
||||
}, func() []error {
|
||||
ok, errs = a.sync(run, c)
|
||||
ok, errs = a.SyncRun(run, c)
|
||||
return errs
|
||||
})
|
||||
|
||||
|
|
@ -452,7 +452,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
|
|||
err := a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
includeCRDs := !c.SkipCRDs()
|
||||
|
||||
prepErr := run.withPreparedCharts("apply", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("apply", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
|
|
@ -497,7 +497,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
|
|||
|
||||
func (a *App) Status(c StatusesConfigProvider) error {
|
||||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
err := run.withPreparedCharts("status", state.ChartPrepareOptions{
|
||||
err := run.WithPreparedCharts("status", state.ChartPrepareOptions{
|
||||
SkipRepos: true,
|
||||
SkipDeps: true,
|
||||
Concurrency: c.Concurrency(),
|
||||
|
|
@ -517,7 +517,7 @@ func (a *App) Status(c StatusesConfigProvider) error {
|
|||
func (a *App) Destroy(c DestroyConfigProvider) error {
|
||||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
if !c.SkipCharts() {
|
||||
err := run.withPreparedCharts("destroy", state.ChartPrepareOptions{
|
||||
err := run.WithPreparedCharts("destroy", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
|
|
@ -546,7 +546,7 @@ func (a *App) Test(c TestConfigProvider) error {
|
|||
"or set helm.sh/hook-delete-policy\n")
|
||||
}
|
||||
|
||||
err := run.withPreparedCharts("test", state.ChartPrepareOptions{
|
||||
err := run.WithPreparedCharts("test", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipRefresh() || c.SkipDeps(),
|
||||
SkipRefresh: c.SkipRefresh(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
|
|
@ -567,7 +567,7 @@ func (a *App) Test(c TestConfigProvider) error {
|
|||
func (a *App) PrintDAGState(c DAGConfigProvider) error {
|
||||
var err error
|
||||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
err = run.withPreparedCharts("show-dag", state.ChartPrepareOptions{
|
||||
err = run.WithPreparedCharts("show-dag", state.ChartPrepareOptions{
|
||||
SkipRepos: true,
|
||||
SkipDeps: true,
|
||||
Concurrency: 2,
|
||||
|
|
@ -584,7 +584,7 @@ func (a *App) PrintDAGState(c DAGConfigProvider) error {
|
|||
|
||||
func (a *App) PrintState(c StateConfigProvider) error {
|
||||
return a.ForEachState(func(run *Run) (_ bool, errs []error) {
|
||||
err := run.withPreparedCharts("build", state.ChartPrepareOptions{
|
||||
err := run.WithPreparedCharts("build", state.ChartPrepareOptions{
|
||||
SkipRepos: true,
|
||||
SkipDeps: true,
|
||||
Concurrency: 2,
|
||||
|
|
@ -657,7 +657,7 @@ func (a *App) ListReleases(c ListConfigProvider) error {
|
|||
var listErr error
|
||||
|
||||
if !c.SkipCharts() {
|
||||
prepErr := run.withPreparedCharts("list", state.ChartPrepareOptions{
|
||||
prepErr := run.WithPreparedCharts("list", state.ChartPrepareOptions{
|
||||
SkipRepos: true,
|
||||
SkipDeps: true,
|
||||
Concurrency: 2,
|
||||
|
|
@ -2115,7 +2115,7 @@ func (a *App) status(r *Run, c StatusesConfigProvider) (bool, []error) {
|
|||
return true, errs
|
||||
}
|
||||
|
||||
func (a *App) sync(r *Run, c SyncConfigProvider) (bool, []error) {
|
||||
func (a *App) SyncRun(r *Run, c SyncConfigProvider) (bool, []error) {
|
||||
st := r.state
|
||||
helm := r.helm
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func (r *Run) prepareChartsIfNeeded(helmfileCommand string, dir string, concurre
|
|||
return releaseToChart, nil
|
||||
}
|
||||
|
||||
func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepareOptions, f func() []error) error {
|
||||
func (r *Run) WithPreparedCharts(helmfileCommand string, opts state.ChartPrepareOptions, f func() []error) error {
|
||||
if r.ReleaseToChart != nil {
|
||||
panic("Run.PrepareCharts can be called only once")
|
||||
}
|
||||
|
|
@ -238,3 +238,11 @@ func (r *Run) diff(triggerCleanupEvent bool, detailedExitCode bool, c DiffConfig
|
|||
|
||||
return &infoMsg, releasesToBeUpdated, releasesToBeDeleted, nil
|
||||
}
|
||||
|
||||
func (r *Run) GetState() *state.HelmState {
|
||||
return r.state
|
||||
}
|
||||
|
||||
func (r *Run) GetHelm() helmexec.Interface {
|
||||
return r.helm
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue