diff --git a/cli/command/image/push.go b/cli/command/image/push.go index 65b562a45f..dd1c32ba72 100644 --- a/cli/command/image/push.go +++ b/cli/command/image/push.go @@ -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 -// -//nolint:gocyclo func RunPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error { var platform *ocispec.Platform 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 - repoInfo, err := registry.ParseRepositoryInfo(ref) - if err != nil { - return err - } + repoInfo, _ := registry.ParseRepositoryInfo(ref) // Resolve the Auth config relevant for this server authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), repoInfo.Index) diff --git a/cli/command/plugin/install.go b/cli/command/plugin/install.go index 17d6ae3847..47b0c97ee9 100644 --- a/cli/command/plugin/install.go +++ b/cli/command/plugin/install.go @@ -64,10 +64,7 @@ func buildPullConfig(ctx context.Context, dockerCli command.Cli, opts pluginOpti return types.PluginInstallOptions{}, err } - repoInfo, err := registry.ParseRepositoryInfo(ref) - if err != nil { - return types.PluginInstallOptions{}, err - } + repoInfo, _ := registry.ParseRepositoryInfo(ref) remote := ref.String() diff --git a/cli/command/plugin/push.go b/cli/command/plugin/push.go index ca05f9dd8c..85bbd4b496 100644 --- a/cli/command/plugin/push.go +++ b/cli/command/plugin/push.go @@ -49,10 +49,7 @@ func runPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error named = reference.TagNameOnly(named) - repoInfo, err := registry.ParseRepositoryInfo(named) - if err != nil { - return err - } + repoInfo, _ := registry.ParseRepositoryInfo(named) authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), repoInfo.Index) encodedAuth, err := registrytypes.EncodeAuthConfig(authConfig) if err != nil { diff --git a/cli/command/service/trust.go b/cli/command/service/trust.go index cb32534d37..6fb4d129a5 100644 --- a/cli/command/service/trust.go +++ b/cli/command/service/trust.go @@ -51,11 +51,7 @@ func resolveServiceImageDigestContentTrust(dockerCli command.Cli, service *swarm } func trustedResolveDigest(cli command.Cli, ref reference.NamedTagged) (reference.Canonical, error) { - repoInfo, err := registry.ParseRepositoryInfo(ref) - if err != nil { - return nil, err - } - + repoInfo, _ := registry.ParseRepositoryInfo(ref) authConfig := command.ResolveAuthConfig(cli.ConfigFile(), repoInfo.Index) notaryRepo, err := trust.GetNotaryRepository(cli.In(), cli.Out(), command.UserAgent(), repoInfo, &authConfig, "pull") diff --git a/cli/registry/client/endpoint.go b/cli/registry/client/endpoint.go index 407b8ac6f1..ab35e73c44 100644 --- a/cli/registry/client/endpoint.go +++ b/cli/registry/client/endpoint.go @@ -30,10 +30,7 @@ func (r repositoryEndpoint) BaseURL() string { } func newDefaultRepositoryEndpoint(ref reference.Named, insecure bool) (repositoryEndpoint, error) { - repoInfo, err := registry.ParseRepositoryInfo(ref) - if err != nil { - return repositoryEndpoint{}, err - } + repoInfo, _ := registry.ParseRepositoryInfo(ref) endpoint, err := getDefaultEndpointFromRepoInfo(repoInfo) if err != nil { return repositoryEndpoint{}, err diff --git a/cli/registry/client/fetcher.go b/cli/registry/client/fetcher.go index 767d1129ce..f0a2f9869a 100644 --- a/cli/registry/client/fetcher.go +++ b/cli/registry/client/fetcher.go @@ -220,10 +220,7 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named, return err } - repoInfo, err := registry.ParseRepositoryInfo(namedRef) - if err != nil { - return err - } + repoInfo, _ := registry.ParseRepositoryInfo(namedRef) confirmedTLSRegistries := make(map[string]bool) 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). 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 if insecure { 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 { return []registry.APIEndpoint{}, err } + repoInfo, _ := registry.ParseRepositoryInfo(namedRef) endpoints, err := registryService.LookupPullEndpoints(reference.Domain(repoInfo.Name)) logrus.Debugf("endpoints for %s: %v", namedRef, endpoints) return endpoints, err diff --git a/cli/trust/trust.go b/cli/trust/trust.go index 62bbd8f833..5e7aff3d54 100644 --- a/cli/trust/trust.go +++ b/cli/trust/trust.go @@ -322,11 +322,7 @@ func GetImageReferencesAndAuth(ctx context.Context, } // Resolve the Repository name from fqn to RepositoryInfo - repoInfo, err := registry.ParseRepositoryInfo(ref) - if err != nil { - return ImageRefAndAuth{}, err - } - + repoInfo, _ := registry.ParseRepositoryInfo(ref) authConfig := authResolver(ctx, repoInfo.Index) return ImageRefAndAuth{ original: imgName,