From 5cdec2dd51d5573c6c7751ca92ec25856b8e4d53 Mon Sep 17 00:00:00 2001 From: yxxhero <11087727+yxxhero@users.noreply.github.com> Date: Sun, 12 Mar 2023 00:28:39 +0800 Subject: [PATCH] clean: helm v2 logic code (#736) Signed-off-by: yxxhero --- pkg/envvar/const.go | 1 - pkg/helmexec/exec.go | 6 ------ pkg/helmexec/exec_test.go | 9 --------- 3 files changed, 16 deletions(-) diff --git a/pkg/envvar/const.go b/pkg/envvar/const.go index 349f5653..1a8bcd97 100644 --- a/pkg/envvar/const.go +++ b/pkg/envvar/const.go @@ -7,7 +7,6 @@ const ( Experimental = "HELMFILE_EXPERIMENTAL" // environment variable for experimental features, expecting "true" lower case Environment = "HELMFILE_ENVIRONMENT" TempDir = "HELMFILE_TEMPDIR" - Helm3 = "HELMFILE_HELM3" UpgradeNoticeDisabled = "HELMFILE_UPGRADE_NOTICE_DISABLED" V1Mode = "HELMFILE_V1MODE" GoccyGoYaml = "HELMFILE_GOCCY_GOYAML" diff --git a/pkg/helmexec/exec.go b/pkg/helmexec/exec.go index a5095ad6..59295094 100644 --- a/pkg/helmexec/exec.go +++ b/pkg/helmexec/exec.go @@ -18,7 +18,6 @@ import ( "helm.sh/helm/v3/pkg/cli" "helm.sh/helm/v3/pkg/plugin" - "github.com/helmfile/helmfile/pkg/envvar" "github.com/helmfile/helmfile/pkg/yaml" ) @@ -72,11 +71,6 @@ func parseHelmVersion(versionStr string) (semver.Version, error) { return semver.Version{}, fmt.Errorf("error parsing helm version '%s'", versionStr) } - // Support explicit helm3 opt-in via environment variable - if os.Getenv(envvar.Helm3) != "" && ver.Major() < 3 { - return *semver.MustParse("v3.0.0"), nil - } - return *ver, nil } diff --git a/pkg/helmexec/exec_test.go b/pkg/helmexec/exec_test.go index 4a2ce848..3429ea4d 100644 --- a/pkg/helmexec/exec_test.go +++ b/pkg/helmexec/exec_test.go @@ -13,8 +13,6 @@ import ( "github.com/Masterminds/semver/v3" "github.com/google/go-cmp/cmp" "go.uber.org/zap" - - "github.com/helmfile/helmfile/pkg/envvar" ) // Mocking the command-line runner @@ -901,13 +899,6 @@ func Test_IsHelm3(t *testing.T) { if !helm.IsHelm3() { t.Error("helmexec.IsHelm3() - Failed to detect Helm 3") } - - t.Setenv(envvar.Helm3, "1") - helm2Runner = mockRunner{output: []byte("Client: v2.16.0+ge13bc94\n")} - helm = New("helm", false, NewLogger(os.Stdout, "info"), "dev", &helm2Runner) - if !helm.IsHelm3() { - t.Errorf("helmexec.IsHelm3() - Helm3 not detected when %s is set", envvar.Helm3) - } } func Test_GetPluginVersion(t *testing.T) {