-
Notifications
You must be signed in to change notification settings - Fork 7
feat: expose registry name mapping methods #76
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #76 +/- ##
==========================================
- Coverage 82.73% 82.46% -0.28%
==========================================
Files 6 6
Lines 388 382 -6
==========================================
- Hits 321 315 -6
Misses 45 45
Partials 22 22
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
registry.go
Outdated
if reg == "" { | ||
return auth.EmptyCredential, nil | ||
} | ||
return store.Get(ctx, reg) | ||
} | ||
} | ||
|
||
func mapStoreRegistryName(registry string) string { | ||
func MapRegistryNameDockerIo(registry string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name is not meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method maps a registry name to a key for credential store. Therefore, func ServerAddressFromRegistry(registry string) string
with documentation is preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed accordingly.
registry.go
Outdated
@@ -89,7 +89,7 @@ func mapStoreRegistryName(registry string) string { | |||
return registry | |||
} | |||
|
|||
func mapAuthenticationRegistryName(hostname string) string { | |||
func MapRegistryNameRegistry1DockerIo(hostname string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name is not meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method maps a host name to a key for credential store. Therefore, func ServerAddressFromHostname(hostname string) string
with documentation is preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed accordingly.
registry.go
Outdated
// ServerAddressFromRegistry maps a registry to a server address, which is used as | ||
// a key for credentials store. The Docker CLI expects that the credentials of | ||
// the registry 'docker.io' will be added under the key "https://index.docker.io/v1/". | ||
// See: https://github.com/moby/moby/blob/v24.0.0-beta.2/registry/config.go#L25-L48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: v24.0.2
is out.
// See: https://github.com/moby/moby/blob/v24.0.0-beta.2/registry/config.go#L25-L48 | |
// See: https://github.com/moby/moby/blob/v24.0.2/registry/config.go#L25-L48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the version number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
registry.go
Outdated
// ServerAddressFromHostname maps a hostname to a server address, which is used as | ||
// a key for credentials store. It is expected that the traffic targetting the | ||
// host "registry-1.docker.io" will be redirected to "https://index.docker.io/v1/". | ||
// https://github.com/moby/moby/blob/v24.0.2/registry/config.go#L25-L48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consistency
// https://github.com/moby/moby/blob/v24.0.2/registry/config.go#L25-L48 | |
// See: https://github.com/moby/moby/blob/v24.0.2/registry/config.go#L25-L48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Signed-off-by: Xiaoxuan Wang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves #72