diff --git a/internal/resolver/resolver.go b/internal/resolver/resolver.go index 7fc27acac89..634b351a6e5 100644 --- a/internal/resolver/resolver.go +++ b/internal/resolver/resolver.go @@ -39,15 +39,17 @@ const FeatureGateOCI = gates.Gate("HELM_EXPERIMENTAL_OCI") // Resolver resolves dependencies from semantic version ranges to a particular version. type Resolver struct { - chartpath string - cachepath string + chartpath string + cachepath string + registryClient *registry.Client } -// New creates a new resolver for a given chart and a given helm home. -func New(chartpath, cachepath string) *Resolver { +// New creates a new resolver for a given chart, helm home and registry client. +func New(chartpath, cachepath string, registryClient *registry.Client) *Resolver { return &Resolver{ - chartpath: chartpath, - cachepath: cachepath, + chartpath: chartpath, + cachepath: cachepath, + registryClient: registryClient, } } diff --git a/internal/resolver/resolver_test.go b/internal/resolver/resolver_test.go index 419f8f316f8..6fbc2e86af2 100644 --- a/internal/resolver/resolver_test.go +++ b/internal/resolver/resolver_test.go @@ -19,6 +19,7 @@ import ( "runtime" "testing" + "helm.sh/helm/v3/internal/experimental/registry" "helm.sh/helm/v3/pkg/chart" ) @@ -139,7 +140,8 @@ func TestResolve(t *testing.T) { } repoNames := map[string]string{"alpine": "kubernetes-charts", "redis": "kubernetes-charts"} - r := New("testdata/chartpath", "testdata/repository") + registryClient, _ := registry.NewClient() + r := New("testdata/chartpath", "testdata/repository", registryClient) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { l, err := r.Resolve(tt.req, repoNames) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 8fd17fa1434..74286b3fdfd 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -232,7 +232,7 @@ func (m *Manager) loadChartDir() (*chart.Chart, error) { // // This returns a lock file, which has all of the dependencies normalized to a specific version. func (m *Manager) resolve(req []*chart.Dependency, repoNames map[string]string) (*chart.Lock, error) { - res := resolver.New(m.ChartPath, m.RepositoryCache) + res := resolver.New(m.ChartPath, m.RepositoryCache, m.RegistryClient) // NOTE: When OCI dependencies specify a semver range in Version, // (*Resolver).Resolve must somehow get the list of OCI tag versions // available to check against this constraint. However for backward