mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Avoid querying for OCI tags can explicit version provided in chart dependencies
Signed-off-by: Andrew Block <andy.block@gmail.com>
This commit is contained in:
parent
86a94f2f53
commit
01ff5bb00d
1 changed files with 26 additions and 12 deletions
|
|
@ -135,22 +135,36 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string
|
|||
found = false
|
||||
} else {
|
||||
version = d.Version
|
||||
// Retrieve list of tags for repository
|
||||
ref := fmt.Sprintf("%s/%s", strings.TrimPrefix(d.Repository, fmt.Sprintf("%s://", registry.OCIScheme)), d.Name)
|
||||
tags, err := r.registryClient.Tags(ref)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not retrieve list of tags for repository %s", d.Repository)
|
||||
}
|
||||
|
||||
vs = make(repo.ChartVersions, len(tags))
|
||||
for ti, t := range tags {
|
||||
// Mock chart version objects
|
||||
version := &repo.ChartVersion{
|
||||
// Check to see if an explicit version has been provided
|
||||
_, err := semver.NewVersion(version)
|
||||
|
||||
// Use an explicit version, otherwise search for tags
|
||||
if err == nil {
|
||||
vs = []*repo.ChartVersion{{
|
||||
Metadata: &chart.Metadata{
|
||||
Version: t,
|
||||
Version: version,
|
||||
},
|
||||
}}
|
||||
|
||||
} else {
|
||||
// Retrieve list of tags for repository
|
||||
ref := fmt.Sprintf("%s/%s", strings.TrimPrefix(d.Repository, fmt.Sprintf("%s://", registry.OCIScheme)), d.Name)
|
||||
tags, err := r.registryClient.Tags(ref)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not retrieve list of tags for repository %s", d.Repository)
|
||||
}
|
||||
|
||||
vs = make(repo.ChartVersions, len(tags))
|
||||
for ti, t := range tags {
|
||||
// Mock chart version objects
|
||||
version := &repo.ChartVersion{
|
||||
Metadata: &chart.Metadata{
|
||||
Version: t,
|
||||
},
|
||||
}
|
||||
vs[ti] = version
|
||||
}
|
||||
vs[ti] = version
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue