fix: issue with pre-release Helm version (#1293)
This commit is contained in:
parent
98cc970d85
commit
008b2dd1d4
|
|
@ -121,6 +121,12 @@ func New(helmBinary string, options HelmExecOptions, logger *zap.SugaredLogger,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if version.Prerelease() != "" {
|
||||||
|
logger.Warnf("Helm version %s is a pre-release version. This may cause problems when deploying Helm charts.\n", version)
|
||||||
|
*version, _ = version.SetPrerelease("")
|
||||||
|
}
|
||||||
|
|
||||||
return &execer{
|
return &execer{
|
||||||
helmBinary: helmBinary,
|
helmBinary: helmBinary,
|
||||||
options: options,
|
options: options,
|
||||||
|
|
|
||||||
|
|
@ -804,6 +804,17 @@ exec: helm --kube-context dev chart pull chart
|
||||||
chartFlags: []string{"--untardir", "/tmp/dir"},
|
chartFlags: []string{"--untardir", "/tmp/dir"},
|
||||||
listResult: `Pulling repo/helm-charts:0.14.0
|
listResult: `Pulling repo/helm-charts:0.14.0
|
||||||
exec: helm --kube-context dev pull oci://repo/helm-charts --version 0.14.0 --destination path1 --untar --untardir /tmp/dir
|
exec: helm --kube-context dev pull oci://repo/helm-charts --version 0.14.0 --destination path1 --untar --untardir /tmp/dir
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "more then v3.7.0 with rc",
|
||||||
|
helmBin: "helm",
|
||||||
|
helmVersion: "v3.14.0-rc.1+g69dcc92",
|
||||||
|
chartName: "repo/helm-charts:0.14.0",
|
||||||
|
chartPath: "path1",
|
||||||
|
chartFlags: []string{"--untardir", "/tmp/dir"},
|
||||||
|
listResult: `Pulling repo/helm-charts:0.14.0
|
||||||
|
exec: helm --kube-context dev pull oci://repo/helm-charts --version 0.14.0 --destination path1 --untar --untardir /tmp/dir
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -811,13 +822,7 @@ exec: helm --kube-context dev pull oci://repo/helm-charts --version 0.14.0 --des
|
||||||
tt := tests[i]
|
tt := tests[i]
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
buffer.Reset()
|
buffer.Reset()
|
||||||
helm := &execer{
|
helm := New(tt.helmBin, HelmExecOptions{}, logger, "dev", &mockRunner{output: []byte(tt.helmVersion)})
|
||||||
helmBinary: tt.helmBin,
|
|
||||||
version: semver.MustParse(tt.helmVersion),
|
|
||||||
logger: logger,
|
|
||||||
kubeContext: "dev",
|
|
||||||
runner: &mockRunner{},
|
|
||||||
}
|
|
||||||
err := helm.ChartPull(tt.chartName, tt.chartPath, tt.chartFlags...)
|
err := helm.ChartPull(tt.chartName, tt.chartPath, tt.chartFlags...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %v", err)
|
t.Errorf("unexpected error: %v", err)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue