-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
cli/command/registry: assorted refactor and test changes #5667
Conversation
Be more explicit on not returning a response if there was an error; change some non-exported functions to return a pointer, and return nil instead. Signed-off-by: Sebastiaan van Stijn <[email protected]>
This function only needs the API client, not all of the CLI. Signed-off-by: Sebastiaan van Stijn <[email protected]>
This function only needs access to the configfile Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
- also check errors that were previously not handled - use the fakeCLI's buffer instead of creating one manually Signed-off-by: Sebastiaan van Stijn <[email protected]>
Various functions were passing through the API response as a whole, but effectively only needed it for a status message (if any). Reduce what's returned to only the message. Signed-off-by: Sebastiaan van Stijn <[email protected]>
} | ||
return nil | ||
} | ||
|
||
func loginWithStoredCredentials(ctx context.Context, dockerCli command.Cli, authConfig registrytypes.AuthConfig) (*registrytypes.AuthenticateOKBody, error) { | ||
func loginWithStoredCredentials(ctx context.Context, dockerCli command.Cli, authConfig registrytypes.AuthConfig) (msg string, _ error) { |
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.
I was going back and forth a bit whether we'd ever would need more from the response returned here, but as we currently don't use anything from that (and these functions already handle the response and store it), as well as these being non-exported, I thought perhaps it's good to just return the thing we need and considering this a good hand-over point for API types to local information.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5667 +/- ##
==========================================
- Coverage 59.53% 59.49% -0.04%
==========================================
Files 346 346
Lines 29356 29358 +2
==========================================
- Hits 17477 17468 -9
- Misses 10909 10918 +9
- Partials 970 972 +2 |
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, thanks!
cli/command/registry: don't return creds on error
Be more explicit on not returning a response if there was an error;
change some non-exported functions to return a pointer, and return
nil instead.
cli/command/registry: loginWithRegistry: use shallower interface
This function only needs the API client, not all of the CLI.
cli/command/registry: storeCredentials: accept configfile as arg
This function only needs access to the configfile
cli/command/registry: TestLoginWithCredStoreCreds slight refactor
cli/command/registry: return status only instead of whole response
Various functions were passing through the API response as a whole, but
effectively only needed it for a status message (if any). Reduce what's
returned to only the message.
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)