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 {
|
||||
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{
|
||||
helmBinary: helmBinary,
|
||||
options: options,
|
||||
|
|
|
|||
|
|
@ -804,6 +804,17 @@ exec: helm --kube-context dev chart pull chart
|
|||
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
|
||||
`,
|
||||
},
|
||||
{
|
||||
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]
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
buffer.Reset()
|
||||
helm := &execer{
|
||||
helmBinary: tt.helmBin,
|
||||
version: semver.MustParse(tt.helmVersion),
|
||||
logger: logger,
|
||||
kubeContext: "dev",
|
||||
runner: &mockRunner{},
|
||||
}
|
||||
helm := New(tt.helmBin, HelmExecOptions{}, logger, "dev", &mockRunner{output: []byte(tt.helmVersion)})
|
||||
err := helm.ChartPull(tt.chartName, tt.chartPath, tt.chartFlags...)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue