From 9d851cda3be9ee077afa6859f58410c761babf2c Mon Sep 17 00:00:00 2001 From: KUOKA Yusuke Date: Thu, 12 Sep 2019 19:33:18 +0900 Subject: [PATCH] feat: `--skip-repos` for `helmfile deps` (#851) Resolves #661 --- main.go | 8 ++++++++ pkg/app/config.go | 1 + pkg/app/run.go | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index a3eb66f9..7dd95eaa 100644 --- a/main.go +++ b/main.go @@ -115,6 +115,10 @@ func main() { Value: "", Usage: "pass args to helm exec", }, + cli.BoolFlag{ + Name: "skip-repos", + Usage: "skip running `helm repo update` before running `helm dependency build`", + }, }, Action: action(func(run *app.App, c configImpl) error { return run.Deps(c) @@ -495,6 +499,10 @@ func (c configImpl) Set() []string { return c.c.StringSlice("set") } +func (c configImpl) SkipRepos() bool { + return c.c.Bool("skip-repos") +} + func (c configImpl) Values() []string { return c.c.StringSlice("values") } diff --git a/pkg/app/config.go b/pkg/app/config.go index 72a612ab..e6b8daa0 100644 --- a/pkg/app/config.go +++ b/pkg/app/config.go @@ -26,6 +26,7 @@ type DeprecatedChartsConfigProvider interface { type DepsConfigProvider interface { Args() string + SkipRepos() bool } type ReposConfigProvider interface { diff --git a/pkg/app/run.go b/pkg/app/run.go index 7ffd492f..94477cb8 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -31,8 +31,10 @@ func (r *Run) askForConfirmation(msg string) bool { func (r *Run) Deps(c DepsConfigProvider) []error { r.helm.SetExtraArgs(argparser.GetArgs(c.Args(), r.state)...) - if errs := r.ctx.SyncReposOnce(r.state, r.helm); errs != nil && len(errs) > 0 { - return errs + if !c.SkipRepos() { + if errs := r.ctx.SyncReposOnce(r.state, r.helm); errs != nil && len(errs) > 0 { + return errs + } } return r.state.UpdateDeps(r.helm)