remove redundant error-handling for registry.ParseRepositoryInfo
Since [moby@c2c3d59], [registry.ParseRepositoryInfo] now always returns a nil error, so we can remove the error handling. [registry.ParseRepositoryInfo]:5f0d6731eb/registry/config.go (L414-L443)
[moby@c2c3d59]:c2c3d593cf
Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
e0979b3adf
commit
bb0e9adbc0
@ -74,8 +74,6 @@ Image index won't be pushed, meaning that other manifests, including attestation
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RunPush performs a push against the engine based on the specified options
|
// RunPush performs a push against the engine based on the specified options
|
||||||
//
|
|
||||||
//nolint:gocyclo
|
|
||||||
func RunPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error {
|
func RunPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error {
|
||||||
var platform *ocispec.Platform
|
var platform *ocispec.Platform
|
||||||
out := tui.NewOutput(dockerCli.Out())
|
out := tui.NewOutput(dockerCli.Out())
|
||||||
@ -107,10 +105,7 @@ To push the complete multi-platform image, remove the --platform flag.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the Repository name from fqn to RepositoryInfo
|
// Resolve the Repository name from fqn to RepositoryInfo
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(ref)
|
repoInfo, _ := registry.ParseRepositoryInfo(ref)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the Auth config relevant for this server
|
// Resolve the Auth config relevant for this server
|
||||||
authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), repoInfo.Index)
|
authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), repoInfo.Index)
|
||||||
|
@ -64,10 +64,7 @@ func buildPullConfig(ctx context.Context, dockerCli command.Cli, opts pluginOpti
|
|||||||
return types.PluginInstallOptions{}, err
|
return types.PluginInstallOptions{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(ref)
|
repoInfo, _ := registry.ParseRepositoryInfo(ref)
|
||||||
if err != nil {
|
|
||||||
return types.PluginInstallOptions{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
remote := ref.String()
|
remote := ref.String()
|
||||||
|
|
||||||
|
@ -49,10 +49,7 @@ func runPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error
|
|||||||
|
|
||||||
named = reference.TagNameOnly(named)
|
named = reference.TagNameOnly(named)
|
||||||
|
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(named)
|
repoInfo, _ := registry.ParseRepositoryInfo(named)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), repoInfo.Index)
|
authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), repoInfo.Index)
|
||||||
encodedAuth, err := registrytypes.EncodeAuthConfig(authConfig)
|
encodedAuth, err := registrytypes.EncodeAuthConfig(authConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -51,11 +51,7 @@ func resolveServiceImageDigestContentTrust(dockerCli command.Cli, service *swarm
|
|||||||
}
|
}
|
||||||
|
|
||||||
func trustedResolveDigest(cli command.Cli, ref reference.NamedTagged) (reference.Canonical, error) {
|
func trustedResolveDigest(cli command.Cli, ref reference.NamedTagged) (reference.Canonical, error) {
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(ref)
|
repoInfo, _ := registry.ParseRepositoryInfo(ref)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
authConfig := command.ResolveAuthConfig(cli.ConfigFile(), repoInfo.Index)
|
authConfig := command.ResolveAuthConfig(cli.ConfigFile(), repoInfo.Index)
|
||||||
|
|
||||||
notaryRepo, err := trust.GetNotaryRepository(cli.In(), cli.Out(), command.UserAgent(), repoInfo, &authConfig, "pull")
|
notaryRepo, err := trust.GetNotaryRepository(cli.In(), cli.Out(), command.UserAgent(), repoInfo, &authConfig, "pull")
|
||||||
|
@ -30,10 +30,7 @@ func (r repositoryEndpoint) BaseURL() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newDefaultRepositoryEndpoint(ref reference.Named, insecure bool) (repositoryEndpoint, error) {
|
func newDefaultRepositoryEndpoint(ref reference.Named, insecure bool) (repositoryEndpoint, error) {
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(ref)
|
repoInfo, _ := registry.ParseRepositoryInfo(ref)
|
||||||
if err != nil {
|
|
||||||
return repositoryEndpoint{}, err
|
|
||||||
}
|
|
||||||
endpoint, err := getDefaultEndpointFromRepoInfo(repoInfo)
|
endpoint, err := getDefaultEndpointFromRepoInfo(repoInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return repositoryEndpoint{}, err
|
return repositoryEndpoint{}, err
|
||||||
|
@ -220,10 +220,7 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(namedRef)
|
repoInfo, _ := registry.ParseRepositoryInfo(namedRef)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
confirmedTLSRegistries := make(map[string]bool)
|
confirmedTLSRegistries := make(map[string]bool)
|
||||||
for _, endpoint := range endpoints {
|
for _, endpoint := range endpoints {
|
||||||
@ -273,11 +270,6 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
|
|||||||
|
|
||||||
// allEndpoints returns a list of endpoints ordered by priority (v2, http).
|
// allEndpoints returns a list of endpoints ordered by priority (v2, http).
|
||||||
func allEndpoints(namedRef reference.Named, insecure bool) ([]registry.APIEndpoint, error) {
|
func allEndpoints(namedRef reference.Named, insecure bool) ([]registry.APIEndpoint, error) {
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(namedRef)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var serviceOpts registry.ServiceOptions
|
var serviceOpts registry.ServiceOptions
|
||||||
if insecure {
|
if insecure {
|
||||||
logrus.Debugf("allowing insecure registry for: %s", reference.Domain(namedRef))
|
logrus.Debugf("allowing insecure registry for: %s", reference.Domain(namedRef))
|
||||||
@ -287,6 +279,7 @@ func allEndpoints(namedRef reference.Named, insecure bool) ([]registry.APIEndpoi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return []registry.APIEndpoint{}, err
|
return []registry.APIEndpoint{}, err
|
||||||
}
|
}
|
||||||
|
repoInfo, _ := registry.ParseRepositoryInfo(namedRef)
|
||||||
endpoints, err := registryService.LookupPullEndpoints(reference.Domain(repoInfo.Name))
|
endpoints, err := registryService.LookupPullEndpoints(reference.Domain(repoInfo.Name))
|
||||||
logrus.Debugf("endpoints for %s: %v", namedRef, endpoints)
|
logrus.Debugf("endpoints for %s: %v", namedRef, endpoints)
|
||||||
return endpoints, err
|
return endpoints, err
|
||||||
|
@ -322,11 +322,7 @@ func GetImageReferencesAndAuth(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the Repository name from fqn to RepositoryInfo
|
// Resolve the Repository name from fqn to RepositoryInfo
|
||||||
repoInfo, err := registry.ParseRepositoryInfo(ref)
|
repoInfo, _ := registry.ParseRepositoryInfo(ref)
|
||||||
if err != nil {
|
|
||||||
return ImageRefAndAuth{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
authConfig := authResolver(ctx, repoInfo.Index)
|
authConfig := authResolver(ctx, repoInfo.Index)
|
||||||
return ImageRefAndAuth{
|
return ImageRefAndAuth{
|
||||||
original: imgName,
|
original: imgName,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user