mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 15:27:03 +02:00
feat: add/expose cli flags (#771)
* feat: add/expose cli flags Signed-off-by: Hans Song <hans.m.song@gmail.com> * fix tests Signed-off-by: Hans Song <hans.m.song@gmail.com> * remove skipdeps from subcommand options Signed-off-by: Hans Song <hans.m.song@gmail.com> * remove skip-deps from subcommand flags Signed-off-by: Hans Song <hans.m.song@gmail.com> * remove SkipDeps from subcommand implementations Signed-off-by: Hans Song <hans.m.song@gmail.com> * update doco with new flags Signed-off-by: Hans Song <hans.m.song@gmail.com> --------- Signed-off-by: Hans Song <hans.m.song@gmail.com>
This commit is contained in:
+15
-6
@@ -28,9 +28,14 @@ type decryptedSecret struct {
|
||||
err error
|
||||
}
|
||||
|
||||
type HelmExecOptions struct {
|
||||
EnableLiveOutput bool
|
||||
DisableForceUpdate bool
|
||||
}
|
||||
|
||||
type execer struct {
|
||||
helmBinary string
|
||||
enableLiveOutput bool
|
||||
options HelmExecOptions
|
||||
version *semver.Version
|
||||
runner Runner
|
||||
logger *zap.SugaredLogger
|
||||
@@ -110,7 +115,7 @@ func redactedURL(chart string) string {
|
||||
}
|
||||
|
||||
// New for running helm commands
|
||||
func New(helmBinary string, enableLiveOutput bool, logger *zap.SugaredLogger, kubeContext string, runner Runner) *execer {
|
||||
func New(helmBinary string, options HelmExecOptions, logger *zap.SugaredLogger, kubeContext string, runner Runner) *execer {
|
||||
// TODO: proper error handling
|
||||
version, err := GetHelmVersion(helmBinary, runner)
|
||||
if err != nil {
|
||||
@@ -118,7 +123,7 @@ func New(helmBinary string, enableLiveOutput bool, logger *zap.SugaredLogger, ku
|
||||
}
|
||||
return &execer{
|
||||
helmBinary: helmBinary,
|
||||
enableLiveOutput: enableLiveOutput,
|
||||
options: options,
|
||||
version: version,
|
||||
logger: logger,
|
||||
kubeContext: kubeContext,
|
||||
@@ -136,7 +141,11 @@ func (helm *execer) SetHelmBinary(bin string) {
|
||||
}
|
||||
|
||||
func (helm *execer) SetEnableLiveOutput(enableLiveOutput bool) {
|
||||
helm.enableLiveOutput = enableLiveOutput
|
||||
helm.options.EnableLiveOutput = enableLiveOutput
|
||||
}
|
||||
|
||||
func (helm *execer) SetDisableForceUpdate(forceUpdate bool) {
|
||||
helm.options.DisableForceUpdate = forceUpdate
|
||||
}
|
||||
|
||||
func (helm *execer) AddRepo(name, repository, cafile, certfile, keyfile, username, password string, managed string, passCredentials string, skipTLSVerify string) error {
|
||||
@@ -156,7 +165,7 @@ func (helm *execer) AddRepo(name, repository, cafile, certfile, keyfile, usernam
|
||||
|
||||
// See https://github.com/helm/helm/pull/8777
|
||||
if cons, err := semver.NewConstraint(">= 3.3.2"); err == nil {
|
||||
if cons.Check(helm.version) {
|
||||
if !helm.options.DisableForceUpdate && cons.Check(helm.version) {
|
||||
args = append(args, "--force-update")
|
||||
}
|
||||
} else {
|
||||
@@ -525,7 +534,7 @@ func (helm *execer) exec(args []string, env map[string]string, overrideEnableLiv
|
||||
}
|
||||
cmd := fmt.Sprintf("exec: %s %s", helm.helmBinary, strings.Join(cmdargs, " "))
|
||||
helm.logger.Debug(cmd)
|
||||
enableLiveOutput := helm.enableLiveOutput
|
||||
enableLiveOutput := helm.options.EnableLiveOutput
|
||||
if overrideEnableLiveOutput != nil {
|
||||
enableLiveOutput = *overrideEnableLiveOutput
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user