diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index 13c994b92..868e3366e 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -20,6 +20,7 @@ import ( "fmt" "net/http" "net/http/httptest" + "path/filepath" "testing" "helm.sh/helm/v3/pkg/repo/repotest" @@ -48,6 +49,8 @@ func TestInstall(t *testing.T) { t.Fatal(err) } + repoFile := filepath.Join(srv.Root(), "repositories.yaml") + tests := []cmdTestCase{ // 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", 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", cmd: "install aeneas reqtest --namespace default --repo " + srv2.URL + " --username username --password password --pass-credentials", diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 2c0d55a55..e79fcb51d 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -221,6 +221,10 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, er } 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 != "" { c.Options = append(c.Options, getter.WithTLSClientConfig(r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile)) }