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]: https://github.com/moby/moby/blob/5f0d6731eb015c8e46b2ae9bb1803d005f2513be/registry/config.go#L414-L443
[moby@c2c3d59]: https://github.com/moby/moby/commit/c2c3d593cf9e24750e99aa0771fac39307d797b3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Sebastiaan van Stijn
2025-03-19 13:55:38 +01:00
committed by Paweł Gronowski
parent e0979b3adf
commit bb0e9adbc0
7 changed files with 8 additions and 37 deletions
+1 -6
View File
@@ -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)
+1 -4
View File
@@ -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()
+1 -4
View File
@@ -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 {
+1 -5
View File
@@ -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")