clean: helm v2 logic code (#736)

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2023-03-12 00:28:39 +08:00 committed by GitHub
parent ccc69399e5
commit 5cdec2dd51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 16 deletions

View File

@ -7,7 +7,6 @@ const (
Experimental = "HELMFILE_EXPERIMENTAL" // environment variable for experimental features, expecting "true" lower case Experimental = "HELMFILE_EXPERIMENTAL" // environment variable for experimental features, expecting "true" lower case
Environment = "HELMFILE_ENVIRONMENT" Environment = "HELMFILE_ENVIRONMENT"
TempDir = "HELMFILE_TEMPDIR" TempDir = "HELMFILE_TEMPDIR"
Helm3 = "HELMFILE_HELM3"
UpgradeNoticeDisabled = "HELMFILE_UPGRADE_NOTICE_DISABLED" UpgradeNoticeDisabled = "HELMFILE_UPGRADE_NOTICE_DISABLED"
V1Mode = "HELMFILE_V1MODE" V1Mode = "HELMFILE_V1MODE"
GoccyGoYaml = "HELMFILE_GOCCY_GOYAML" GoccyGoYaml = "HELMFILE_GOCCY_GOYAML"

View File

@ -18,7 +18,6 @@ import (
"helm.sh/helm/v3/pkg/cli" "helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/plugin" "helm.sh/helm/v3/pkg/plugin"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/helmfile/helmfile/pkg/yaml" "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) 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 return *ver, nil
} }

View File

@ -13,8 +13,6 @@ import (
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"go.uber.org/zap" "go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/envvar"
) )
// Mocking the command-line runner // Mocking the command-line runner
@ -901,13 +899,6 @@ func Test_IsHelm3(t *testing.T) {
if !helm.IsHelm3() { if !helm.IsHelm3() {
t.Error("helmexec.IsHelm3() - Failed to detect Helm 3") 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) { func Test_GetPluginVersion(t *testing.T) {