mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-21 12:38:53 +02:00
add --skip-charts for destroy for disable prepare charts (#637)
* add --skip-charts for destroy for disable prepare charts Signed-off-by: yxxhero <aiopsclub@163.com> * add --skip-charts for delete subcmd Signed-off-by: yxxhero <aiopsclub@163.com> * add docs and e2e test Signed-off-by: yxxhero <aiopsclub@163.com> Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
+25
-20
@@ -455,36 +455,41 @@ func (a *App) Status(c StatusesConfigProvider) error {
|
||||
// TODO: Remove this function once Helmfile v0.x
|
||||
func (a *App) Delete(c DeleteConfigProvider) error {
|
||||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
err := run.withPreparedCharts("delete", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipDeps(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
Concurrency: c.Concurrency(),
|
||||
}, func() {
|
||||
if !c.SkipCharts() {
|
||||
err := run.withPreparedCharts("delete", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipDeps(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
Concurrency: c.Concurrency(),
|
||||
}, func() {
|
||||
ok, errs = a.delete(run, c.Purge(), c)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
} else {
|
||||
ok, errs = a.delete(run, c.Purge(), c)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
return
|
||||
}, false, SetReverse(true))
|
||||
}
|
||||
|
||||
func (a *App) Destroy(c DestroyConfigProvider) error {
|
||||
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
|
||||
err := run.withPreparedCharts("destroy", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipDeps(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
Concurrency: c.Concurrency(),
|
||||
}, func() {
|
||||
if !c.SkipCharts() {
|
||||
err := run.withPreparedCharts("destroy", state.ChartPrepareOptions{
|
||||
SkipRepos: c.SkipDeps(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
Concurrency: c.Concurrency(),
|
||||
}, func() {
|
||||
ok, errs = a.delete(run, true, c)
|
||||
})
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
} else {
|
||||
ok, errs = a.delete(run, true, c)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
return
|
||||
}, false, SetReverse(true))
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ type DeleteConfigProvider interface {
|
||||
|
||||
Purge() bool
|
||||
SkipDeps() bool
|
||||
SkipCharts() bool
|
||||
|
||||
interactive
|
||||
loggingConfig
|
||||
@@ -152,6 +153,7 @@ type DestroyConfigProvider interface {
|
||||
Args() string
|
||||
|
||||
SkipDeps() bool
|
||||
SkipCharts() bool
|
||||
|
||||
interactive
|
||||
loggingConfig
|
||||
|
||||
@@ -39,12 +39,17 @@ type destroyConfig struct {
|
||||
skipDeps bool
|
||||
logger *zap.SugaredLogger
|
||||
includeTransitiveNeeds bool
|
||||
skipCharts bool
|
||||
}
|
||||
|
||||
func (d destroyConfig) Args() string {
|
||||
return d.args
|
||||
}
|
||||
|
||||
func (d destroyConfig) SkipCharts() bool {
|
||||
return d.skipCharts
|
||||
}
|
||||
|
||||
func (d destroyConfig) Interactive() bool {
|
||||
return d.interactive
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ type DeleteOptions struct {
|
||||
Purge bool
|
||||
// SkipDeps is the skip deps flag
|
||||
SkipDeps bool
|
||||
// SkipCharts makes Delete skip `withPreparedCharts`
|
||||
SkipCharts bool
|
||||
}
|
||||
|
||||
// NewDeleteOptions creates a new Apply
|
||||
@@ -44,3 +46,8 @@ func (c *DeleteImpl) Purge() bool {
|
||||
func (c *DeleteImpl) SkipDeps() bool {
|
||||
return c.DeleteOptions.SkipDeps
|
||||
}
|
||||
|
||||
// SkipCharts returns skipCharts flag
|
||||
func (c *DeleteImpl) SkipCharts() bool {
|
||||
return c.DeleteOptions.SkipCharts
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ type DestroyOptions struct {
|
||||
Concurrency int
|
||||
// SkipDeps is the skip deps flag
|
||||
SkipDeps bool
|
||||
// SkipCharts makes Destroy skip `withPreparedCharts`
|
||||
SkipCharts bool
|
||||
}
|
||||
|
||||
// NewDestroyOptions creates a new Apply
|
||||
@@ -36,3 +38,8 @@ func (c *DestroyImpl) Concurrency() int {
|
||||
func (c *DestroyImpl) SkipDeps() bool {
|
||||
return c.DestroyOptions.SkipDeps
|
||||
}
|
||||
|
||||
// SkipCharts returns skipCharts flag
|
||||
func (c *DestroyImpl) SkipCharts() bool {
|
||||
return c.DestroyOptions.SkipCharts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user