[28.x] add internal fork of docker/docker/registry#6221
Merged
austinvazquez merged 15 commits intodocker:28.xfrom Aug 16, 2025
Merged
[28.x] add internal fork of docker/docker/registry#6221austinvazquez merged 15 commits intodocker:28.xfrom
austinvazquez merged 15 commits intodocker:28.xfrom
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
3000dc9 to
65e5128
Compare
10cc8d4 to
d9ee285
Compare
This was referenced Aug 15, 2025
This utility was only used in the CLI, but the implementation was based on it being used on the daemon side, so included resolving the host's IP-address, mirrors, etc. The only reason it's used in the CLI is to provide credentials for the registry that's being searched, so reduce it to just that. There's more cleaning up to do in this area, so to make our lives easier, it's implemented locally as non-exported functions; likely to be replaced with something else. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit e504faf) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This adds an internal fork of [github.com/docker/docker/registry], taken at commit [moby@f651a5d]. Git history was not preserved in this fork, but can be found using the URLs provided. This fork was created to remove the dependency on the "Moby" codebase, and because the CLI only needs a subset of its features. The original package was written specifically for use in the daemon code, and includes functionality that cannot be used in the CLI. [github.com/docker/docker/registry]: https://pkg.go.dev/github.com/docker/docker@v28.3.2+incompatible/registry [moby@49306c6]: https://github.com/moby/moby/tree/49306c607b72c5bf0a8e426f5a9760fa5ef96ea0/registry Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit f6b90bc) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 7716219) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The CLI does not have information about mirrors, and doesn't configure them, so we can remove these parts. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit e0b351b) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 7cf245d) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
It's not matched anywhere, so we can just return a plain error. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit dad2e67) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
It was only used in a single place; inline it there. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit dc41365) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
now that we no longer need to account for mirrors, these were identical, so just use a single one. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 5322aff) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
It was written to be used as validate-func for command-line flags, which we don't use it for (which for CLI-flags includes normalizing the value). The validation itself didn't add much; it only checked the registry didn't start or end with a hyphen (which would still fail when parsing). Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 2607ba8) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The registry.ServiceConfig struct in the API types was meant for the registry configuration on the daemon side; it has variuos fields we don't use, defines methods for (un)marshaling JSON, and a custom version of `net.IPNet`, also to (un)marshal JSON. None of that is needed, so let's change it to a local type, and implement a constructor (as we now only have "insecure registries" to care about). Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 219cfc8) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit c297770) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit cd277a5) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
internal/registry/errors.go:26:43: use-any: since Go 1.18 'interface{}' can be replaced by 'any' (revive)
func invalidParamf(format string, args ...interface{}) error {
^
internal/registry/registry_mock_test.go:52:51: use-any: since Go 1.18 'interface{}' can be replaced by 'any' (revive)
func writeResponse(w http.ResponseWriter, message interface{}, code int) {
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f907c7a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Removed the error return from the `ParseRepositoryInfo` function. There are no validation steps inside `ParseRepositoryInfo` which could cause an error, so we always returned a nil error. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 86b5b52) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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> (cherry picked from commit 21e8bbc) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
d9ee285 to
efdf008
Compare
austinvazquez
approved these changes
Aug 16, 2025
Member
Author
|
Thanks for reviewing @austinvazquez ❤️ ❤️ ❤️ I know it was quite some changes from the look of it, but hope that breaking it down into smaller commit to walk through every step taken helped verify correctness. (most parts are really just moving things around and removing bits not used). |
Contributor
|
+1, @thaJeztah it definitely helps me. I do try to take some time to read through them if I can even if it's backports as I usually can learn a cool thing or two. 😁 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backport;
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)