Skip to content

Commit

Permalink
Added registryClient to resolver
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Block <andy.block@gmail.com>
  • Loading branch information
sabre1041 authored and scottrigby committed Jan 12, 2022
1 parent 1fabbab commit 834a11d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
14 changes: 8 additions & 6 deletions internal/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
4 changes: 3 additions & 1 deletion internal/resolver/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"runtime"
"testing"

"helm.sh/helm/v3/internal/experimental/registry"
"helm.sh/helm/v3/pkg/chart"
)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/downloader/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 834a11d

Please sign in to comment.