Fix regression of v3.6.1 with remote repository and authentiation

Resolves #9820

Signed-off-by: Lüchinger Dominic <dev@snowgarden.ch>
pull/9844/head
Lüchinger Dominic 4 years ago
parent 61d8e8c4a6
commit 175108fe0d
No known key found for this signature in database
GPG Key ID: 5768DD51B4D71C70

@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"path/filepath"
"testing" "testing"
"helm.sh/helm/v3/pkg/repo/repotest" "helm.sh/helm/v3/pkg/repo/repotest"
@ -48,6 +49,8 @@ func TestInstall(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
repoFile := filepath.Join(srv.Root(), "repositories.yaml")
tests := []cmdTestCase{ tests := []cmdTestCase{
// Install, base case // Install, base case
{ {
@ -239,6 +242,11 @@ func TestInstall(t *testing.T) {
cmd: "install aeneas reqtest --namespace default --repo " + srv.URL() + " --username username --password password", cmd: "install aeneas reqtest --namespace default --repo " + srv.URL() + " --username username --password password",
golden: "output/install.txt", golden: "output/install.txt",
}, },
{
name: "basic install with credentials without specify repository url",
cmd: fmt.Sprintf("install aeneas test/reqtest --namespace default --username username --password password --repository-config %s --repository-cache %s", repoFile, srv.Root()),
golden: "output/install.txt",
},
{ {
name: "basic install with credentials", name: "basic install with credentials",
cmd: "install aeneas reqtest --namespace default --repo " + srv2.URL + " --username username --password password --pass-credentials", cmd: "install aeneas reqtest --namespace default --repo " + srv2.URL + " --username username --password password --pass-credentials",

@ -221,6 +221,10 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, er
} }
if r != nil && r.Config != nil { if r != nil && r.Config != nil {
c.Options = append(
c.Options,
getter.WithURL(r.Config.URL),
)
if r.Config.CertFile != "" || r.Config.KeyFile != "" || r.Config.CAFile != "" { if r.Config.CertFile != "" || r.Config.KeyFile != "" || r.Config.CAFile != "" {
c.Options = append(c.Options, getter.WithTLSClientConfig(r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile)) c.Options = append(c.Options, getter.WithTLSClientConfig(r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile))
} }

Loading…
Cancel
Save