-
Notifications
You must be signed in to change notification settings - Fork 2k
[28.x] add internal fork of docker/docker/registry #6221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
3000dc9
to
65e5128
Compare
10cc8d4
to
d9ee285
Compare
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 <[email protected]> (cherry picked from commit e504faf) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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/[email protected]+incompatible/registry [moby@49306c6]: https://github.com/moby/moby/tree/49306c607b72c5bf0a8e426f5a9760fa5ef96ea0/registry Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit f6b90bc) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 7716219) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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 <[email protected]> (cherry picked from commit e0b351b) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 7cf245d) Signed-off-by: Sebastiaan van Stijn <[email protected]>
It's not matched anywhere, so we can just return a plain error. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit dad2e67) Signed-off-by: Sebastiaan van Stijn <[email protected]>
It was only used in a single place; inline it there. Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit dc41365) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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 <[email protected]> (cherry picked from commit 5322aff) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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 <[email protected]> (cherry picked from commit 2607ba8) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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 <[email protected]> (cherry picked from commit 219cfc8) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit c297770) Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit cd277a5) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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 <[email protected]> (cherry picked from commit f907c7a) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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 <[email protected]> (cherry picked from commit 86b5b52) Signed-off-by: Sebastiaan van Stijn <[email protected]>
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 <[email protected]> (cherry picked from commit 21e8bbc) Signed-off-by: Sebastiaan van Stijn <[email protected]>
d9ee285
to
efdf008
Compare
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). |
+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. 😁 |
backport;
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)