Support the latest Helm (>=v3.3.2) and bump the Helm version in Docker image. (#1488)

Changes:

* Bump Helm to v2.16.12 and v3.3.3.
* Add --force-update only when using Helm 3.
This commit is contained in:
Wi1dcard
2020-09-21 09:41:49 +09:00
committed by GitHub
parent 028bcc51dc
commit 988c218096
10 changed files with 23 additions and 19 deletions
+5 -2
View File
@@ -130,6 +130,9 @@ func (helm *execer) AddRepo(name, repository, cafile, certfile, keyfile, usernam
return fmt.Errorf("empty field name")
}
args = append(args, "repo", "add", name, repository)
if helm.IsHelm3() && helm.IsVersionAtLeast(3, 3, 2) {
args = append(args, "--force-update")
}
if certfile != "" && keyfile != "" {
args = append(args, "--cert-file", certfile, "--key-file", keyfile)
}
@@ -398,6 +401,6 @@ func (helm *execer) GetVersion() Version {
return helm.version
}
func (helm *execer) IsVersionAtLeast(major int, minor int) bool {
return helm.version.Major >= major && helm.version.Minor >= minor
func (helm *execer) IsVersionAtLeast(major int, minor int, patch int) bool {
return helm.version.Major >= major && helm.version.Minor >= minor && helm.version.Patch >= patch
}
+3 -3
View File
@@ -557,15 +557,15 @@ func Test_GetVersion(t *testing.T) {
func Test_IsVersionAtLeast(t *testing.T) {
helm2Runner := mockRunner{output: []byte("Client: v2.16.1+ge13bc94\n")}
helm := New("helm", NewLogger(os.Stdout, "info"), "dev", &helm2Runner)
if !helm.IsVersionAtLeast(2, 1) {
if !helm.IsVersionAtLeast(2, 1, 0) {
t.Error("helmexec.IsVersionAtLeast - 2.16.1 not atleast 2.1")
}
if helm.IsVersionAtLeast(2, 19) {
if helm.IsVersionAtLeast(2, 19, 0) {
t.Error("helmexec.IsVersionAtLeast - 2.16.1 is atleast 2.19")
}
if helm.IsVersionAtLeast(3, 2) {
if helm.IsVersionAtLeast(3, 2, 0) {
t.Error("helmexec.IsVersionAtLeast - 2.16.1 is atleast 3.2")
}
+1 -1
View File
@@ -28,7 +28,7 @@ type Interface interface {
DecryptSecret(context HelmContext, name string, flags ...string) (string, error)
IsHelm3() bool
GetVersion() Version
IsVersionAtLeast(major int, minor int) bool
IsVersionAtLeast(major int, minor int, patch int) bool
}
type DependencyUpdater interface {