Fix destory, delete, and test to work with chartify on local chart with dependencies that are not yet downloaded (#1801)

Fixes #1800
This commit is contained in:
Yusuke Kuoka 2021-04-24 20:50:16 +09:00 committed by GitHub
parent ce6a621414
commit 5a3bd7d649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 6 deletions

12
main.go
View File

@ -554,6 +554,10 @@ func main() {
Name: "purge",
Usage: "purge releases i.e. free release names and histories",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: `skip running "helm repo update" and "helm dependency build"`,
},
},
Action: action(func(a *app.App, c configImpl) error {
return a.Delete(c)
@ -573,6 +577,10 @@ func main() {
Value: "",
Usage: "pass args to helm exec",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: `skip running "helm repo update" and "helm dependency build"`,
},
},
Action: action(func(a *app.App, c configImpl) error {
return a.Destroy(c)
@ -605,6 +613,10 @@ func main() {
Value: 0,
Usage: "maximum number of concurrent helm processes to run, 0 is unlimited",
},
cli.BoolFlag{
Name: "skip-deps",
Usage: `skip running "helm repo update" and "helm dependency build"`,
},
},
Action: action(func(a *app.App, c configImpl) error {
return a.Test(c)

View File

@ -396,8 +396,8 @@ func (a *App) Status(c StatusesConfigProvider) error {
func (a *App) Delete(c DeleteConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
err := run.withPreparedCharts("delete", state.ChartPrepareOptions{
SkipRepos: true,
SkipDeps: true,
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
}, func() {
ok, errs = a.delete(run, c.Purge(), c)
})
@ -413,8 +413,8 @@ func (a *App) Delete(c DeleteConfigProvider) error {
func (a *App) Destroy(c DestroyConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
err := run.withPreparedCharts("destroy", state.ChartPrepareOptions{
SkipRepos: true,
SkipDeps: true,
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
}, func() {
ok, errs = a.delete(run, true, c)
})
@ -436,8 +436,8 @@ func (a *App) Test(c TestConfigProvider) error {
}
err := run.withPreparedCharts("test", state.ChartPrepareOptions{
SkipRepos: true,
SkipDeps: true,
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
}, func() {
errs = a.test(run, c)
})

View File

@ -114,6 +114,7 @@ type DeleteConfigProvider interface {
Args() string
Purge() bool
SkipDeps() bool
interactive
loggingConfig
@ -123,6 +124,8 @@ type DeleteConfigProvider interface {
type DestroyConfigProvider interface {
Args() string
SkipDeps() bool
interactive
loggingConfig
concurrencyConfig
@ -131,6 +134,7 @@ type DestroyConfigProvider interface {
type TestConfigProvider interface {
Args() string
SkipDeps() bool
Timeout() int
Cleanup() bool
Logs() bool

View File

@ -26,6 +26,7 @@ type destroyConfig struct {
args string
concurrency int
interactive bool
skipDeps bool
logger *zap.SugaredLogger
}
@ -45,6 +46,10 @@ func (d destroyConfig) Concurrency() int {
return d.concurrency
}
func (d destroyConfig) SkipDeps() bool {
return d.skipDeps
}
func TestDestroy(t *testing.T) {
type testcase struct {
helm3 bool