From c83ba69f3ec60064097e8f194d39c12c5efbaaa5 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Fri, 23 Dec 2022 09:29:03 +0900 Subject: [PATCH] Re: Remove deprecated args and cmd for v1.0.0 (#598) This is a successor to #442 rebuilt on top of #594 so that we can merge this while we are still at Hemlfile v0.x without worrying any backward-incompatibility. Signed-off-by: Yusuke Kuoka Signed-off-by: Yusuke Kuoka --- cmd/apply.go | 9 ++++++--- cmd/root.go | 9 +++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cmd/apply.go b/cmd/apply.go index dbadac51..df369ff9 100644 --- a/cmd/apply.go +++ b/cmd/apply.go @@ -5,6 +5,7 @@ import ( "github.com/helmfile/helmfile/pkg/app" "github.com/helmfile/helmfile/pkg/config" + "github.com/helmfile/helmfile/pkg/runtime" ) // NewApplyCmd returns apply subcmd @@ -40,9 +41,11 @@ func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command { f.StringVar(&applyOptions.Output, "output", "", "output format for diff plugin") f.BoolVar(&applyOptions.DetailedExitcode, "detailed-exitcode", false, "return a non-zero exit code 2 instead of 0 when there were changes detected AND the changes are synced successfully") f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec") - f.BoolVar(&applyOptions.RetainValuesFiles, "retain-values-files", false, "DEPRECATED: Use skip-cleanup instead") - // mark retain-values-files as deprecated, but keep it for backward compatibility, will be removed in the future - _ = f.MarkDeprecated("retain-values-files", "Use skip-cleanup instead") + if !runtime.V1Mode { + f.BoolVar(&applyOptions.RetainValuesFiles, "retain-values-files", false, "DEPRECATED: Use skip-cleanup instead") + // mark retain-values-files as deprecated, but keep it for backward compatibility, will be removed in the future + _ = f.MarkDeprecated("retain-values-files", "Use skip-cleanup instead") + } f.BoolVar(&applyOptions.SkipCleanup, "skip-cleanup", false, "Stop cleaning up temporary values generated by helmfile and helm-secrets. Useful for debugging. Don't use in production for security") f.BoolVar(&applyOptions.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed on sync. By default, CRDs are installed if not already present") diff --git a/cmd/root.go b/cmd/root.go index 88e6cd30..c3fd1d5b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -86,8 +86,6 @@ func NewRootCmd(globalConfig *config.GlobalOptions) (*cobra.Command, error) { NewApplyCmd(globalImpl), NewBuildCmd(globalImpl), NewCacheCmd(globalImpl), - NewChartsCmd(globalImpl), - NewDeleteCmd(globalImpl), NewDepsCmd(globalImpl), NewDestroyCmd(globalImpl), NewFetchCmd(globalImpl), @@ -105,6 +103,13 @@ func NewRootCmd(globalConfig *config.GlobalOptions) (*cobra.Command, error) { ), ) + if !runtime.V1Mode { + cmd.AddCommand( + NewChartsCmd(globalImpl), + NewDeleteCmd(globalImpl), + ) + } + return cmd, nil }