internal/registry: remove RepositoryInfo, add NewIndexInfo

Most places only use IndexInfo (and may not even need that), so replace
the use of ParseRepositoryInfo for NewIndexInfo, and move the RepositoryInfo
type to the trust package, which uses it as part of its ImageRefAndAuth
struct.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-08-03 14:39:30 +02:00
parent f86ad2ea4c
commit 21e8bbc8a2
12 changed files with 62 additions and 63 deletions

View File

@ -34,8 +34,7 @@ func (r repositoryEndpoint) BaseURL() string {
func newDefaultRepositoryEndpoint(ref reference.Named, insecure bool) (repositoryEndpoint, error) {
repoName := reference.TrimNamed(ref)
repoInfo := registry.ParseRepositoryInfo(ref)
indexInfo := repoInfo.Index
indexInfo := registry.NewIndexInfo(ref)
endpoint, err := getDefaultEndpoint(ref, !indexInfo.Secure)
if err != nil {

View File

@ -221,8 +221,7 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
}
repoName := reference.TrimNamed(namedRef)
repoInfo := registry.ParseRepositoryInfo(namedRef)
indexInfo := repoInfo.Index
indexInfo := registry.NewIndexInfo(namedRef)
confirmedTLSRegistries := make(map[string]bool)
for _, endpoint := range endpoints {
@ -285,8 +284,7 @@ func allEndpoints(namedRef reference.Named, insecure bool) ([]registry.APIEndpoi
if err != nil {
return nil, err
}
repoInfo := registry.ParseRepositoryInfo(namedRef)
endpoints, err := registryService.Endpoints(context.TODO(), reference.Domain(repoInfo.Name))
endpoints, err := registryService.Endpoints(context.TODO(), reference.Domain(namedRef))
logrus.Debugf("endpoints for %s: %v", namedRef, endpoints)
return endpoints, err
}