Sebastiaan van Stijn
55a83aff23
cli/command/manifest: remove redundant uses of ParseRepositoryInfo
[ParseRepositoryInfo] parses an image reference and returns information
about the Repository and the registry. As part of this, it validates if
the registry's hostname is considered valid using [ValidateIndexName],
as well as normalizing the image reference to strip tags and digests
using [reference.TrimNamed].
ValidateIndexName only provides very limited value; the only validation
happening is to check for the hostname to not start, or end with a hyphen.
The cli/command/manifest package used ParseRepositoryInfo in various
locations where only the repository name was used (i.e., the result
of `reference.TrimNamed` on the given reference), and in one location
only used it to validate the registry name.
For buildPushRequest, the call was fully redundant, as [RepoNameForReference]
was used on the result, calling [newDefaultRepositoryEndpoint], which
uses ParseRepositoryInfo internally, so we were only repeating that work.
This patch removes uses of ParseRepositoryInfo in those places, and instead
calling [reference.TrimNamed] directly.
[ParseRepositoryInfo]: https://github.com/moby/moby/blob/41f781fab3cae181cc9be3ec93cd91b99466fa84/registry/config.go#L375-L381
[ValidateIndexName]: https://github.com/moby/moby/blob/41f781fab3cae181cc9be3ec93cd91b99466fa84/registry/config.go#L288-L299
[reference.TrimNamed]: https://github.com/moby/moby/blob/41f781fab3cae181cc9be3ec93cd91b99466fa84/registry/config.go#L369
[RepoNameForReference]: https://github.com/docker/cli/blob/fe0a8d27912dc6fddc60cedcd35bbef27b776355/cli/registry/client/endpoint.go#L107-L110
[newDefaultRepositoryEndpoint]: https://github.com/docker/cli/blob/fe0a8d27912dc6fddc60cedcd35bbef27b776355/cli/registry/client/endpoint.go#L33-L38
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-01 15:40:29 +01:00
..
2024-07-04 01:35:12 +02:00
2025-02-03 13:05:23 +01:00
2022-04-08 16:55:39 +02:00
2025-02-12 12:42:19 +00:00
2025-02-04 12:30:30 +00:00
2025-02-18 13:15:28 +01:00
2025-02-20 17:49:58 +01:00
2025-02-20 18:10:36 +01:00
2025-02-01 15:59:57 +01:00
2025-02-17 15:24:58 +01:00
2025-02-03 19:21:27 +01:00
2025-03-01 15:40:29 +01:00
2025-02-21 12:55:57 +01:00
2025-02-20 18:33:17 +01:00
2025-02-17 14:53:51 +01:00
2025-02-17 15:24:56 +01:00
2025-02-03 19:33:58 +01:00
2025-02-20 18:33:17 +01:00
2025-02-17 15:24:57 +01:00
2025-02-17 15:24:56 +01:00
2025-02-20 18:10:36 +01:00
2024-11-05 10:14:30 +01:00
2019-05-20 13:28:11 +01:00
2025-02-18 13:15:06 +01:00
2025-02-03 20:31:52 +01:00
2023-11-20 16:02:17 +01:00
2025-02-17 15:24:52 +01:00
2025-02-06 19:16:50 +01:00
2025-02-19 10:19:00 -06:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-11-12 12:38:18 +01:00
2024-06-10 21:19:32 +02:00
2025-02-05 12:32:24 +01:00
2024-09-18 10:59:08 +01:00
2024-11-12 12:38:18 +01:00
2024-06-24 15:44:20 +02:00
2024-11-05 10:14:30 +01:00
2024-09-17 10:47:04 -05:00
2025-02-17 15:24:55 +01:00
2018-03-08 15:00:43 -05:00
2025-02-03 12:21:00 +01:00
2024-11-12 12:38:18 +01:00