|
|
|
|
@ -736,31 +736,50 @@ func (m *Manager) findChartURL(name, version, repoURL, repoName string, repos ma
|
|
|
|
|
|
|
|
|
|
// First, try to look up the repository by name. This ensures correct
|
|
|
|
|
// credentials are used when multiple repositories share the same URL.
|
|
|
|
|
// When a repo name is provided and exists in the repos map, the lookup
|
|
|
|
|
// is authoritative: if the chart is not found or URL resolution fails,
|
|
|
|
|
// an error is returned rather than silently falling back to URL-based
|
|
|
|
|
// scanning. If the named repo is not in the repos map (e.g. repos from
|
|
|
|
|
// ensureMissingRepos are not persisted to repositories.yaml), we fall
|
|
|
|
|
// through to URL-based scanning for backward compatibility.
|
|
|
|
|
if repoName != "" {
|
|
|
|
|
if cr, ok := repos[repoName]; ok {
|
|
|
|
|
var entry repo.ChartVersions
|
|
|
|
|
entry, err = findEntryByName(name, cr)
|
|
|
|
|
if err == nil {
|
|
|
|
|
var ve *repo.ChartVersion
|
|
|
|
|
ve, err = findVersionedEntry(version, entry)
|
|
|
|
|
if err == nil {
|
|
|
|
|
url, err = repo.ResolveReferenceURL(cr.Config.URL, ve.URLs[0])
|
|
|
|
|
if err == nil {
|
|
|
|
|
username = cr.Config.Username
|
|
|
|
|
password = cr.Config.Password
|
|
|
|
|
passCredentialsAll = cr.Config.PassCredentialsAll
|
|
|
|
|
insecureSkipTLSVerify = cr.Config.InsecureSkipTLSVerify
|
|
|
|
|
caFile = cr.Config.CAFile
|
|
|
|
|
certFile = cr.Config.CertFile
|
|
|
|
|
keyFile = cr.Config.KeyFile
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if err != nil {
|
|
|
|
|
err = fmt.Errorf("chart %q not found in repository %q", name, repoName)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ve *repo.ChartVersion
|
|
|
|
|
ve, err = findVersionedEntry(version, entry)
|
|
|
|
|
if err != nil {
|
|
|
|
|
err = fmt.Errorf("chart %q version %q not found in repository %q", name, version, repoName)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
url, err = repo.ResolveReferenceURL(cr.Config.URL, ve.URLs[0])
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
username = cr.Config.Username
|
|
|
|
|
password = cr.Config.Password
|
|
|
|
|
passCredentialsAll = cr.Config.PassCredentialsAll
|
|
|
|
|
insecureSkipTLSVerify = cr.Config.InsecureSkipTLSVerify
|
|
|
|
|
caFile = cr.Config.CAFile
|
|
|
|
|
certFile = cr.Config.CertFile
|
|
|
|
|
keyFile = cr.Config.KeyFile
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// Repo name provided but not in the repos map.
|
|
|
|
|
// Fall through to URL-based scanning for backward compatibility
|
|
|
|
|
// (handles repos generated by ensureMissingRepos).
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fall back to scanning repos by URL for backward compatibility.
|
|
|
|
|
// Fall back to scanning repos by URL for backward compatibility
|
|
|
|
|
// (only when no repo name was specified, or the named repo is not in
|
|
|
|
|
// the repos map).
|
|
|
|
|
for _, cr := range repos {
|
|
|
|
|
if urlutil.Equal(repoURL, cr.Config.URL) {
|
|
|
|
|
var entry repo.ChartVersions
|
|
|
|
|
|