client: export config and credential functionalities to 3rd parties#30817
client: export config and credential functionalities to 3rd parties#30817AkihiroSuda wants to merge 2 commits intomoby:masterfrom
Conversation
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
…y 3rd parties Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
|
@vdemeester PTAL? |
|
@AkihiroSuda @dnephin I wonder if this should go int |
|
yes closing |
|
Reopening this PR, because Related: https://forums.mobyproject.org/t/go-client-and-pushing-to-a-restricted-registry/61. |
|
I'll rebase this PR if I can get SGTMs |
|
@AkihiroSuda isn't this all in |
|
|
|
Refactoring this code to make it easier for other consumers sounds great to me. However I don't think it belongs in the How about we keep this in the As long as everything is exported and isn't a method on the |
|
@AkihiroSuda should we open those changes to |
|
ok |
|
WIP: https://github.com/docker/cli/compare/master...AkihiroSuda:config?expand=1 |
Example: contrib/client-with-cli-config (but without whole cli) See also moby/moby#30817 Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
|
opened docker/cli#197 |
Example: contrib/client-with-cli-config (but without whole cli) See also moby/moby#30817 Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
|
Note: this seems settled as docker/cli#227 (thank you @dnephin ) |
- What I did
The
github.com/docker/docker/clientpackage should provide functions that are enough to "do anything the command-line interface does" for 3rd parties, as the README says.However, some functions such as
client.ImagePull()are not so useful, because theclientpackage lacks functions for loading the client config and credentials configured with it.So I added functions related to them to the
clientpackage.- How I did it
Moved some packages and functions from the
clipackage to theclientpackage.client/config: moved fromcli/configclient/clientutil.LoadDefaultConfigFile(): moved fromcli/command/cli.goclient/clientutil.GetAllCredentials(): moved fromcli/command/cli.goclient/clientutil.CredentialsStore(): moved fromcli/command/cli.goclient/clientutil.ElectAuthServer(): moved fromcli/command/registry.goclient/clientutil.EncodeAuthToBase64(): moved fromcli/command/registry.goclient/clientutil.ResolveAuthConfig(): moved fromcli/command/registry.go- How to verify it
Prepare
main.golike this:Without the new functions added in this PR, the program cannot pull an image that requires the credential.
With the new functions (
-ex), the program should be able to pull the image.- Description for the changelog
client: export config and credential functionalities to 3rd parties
- A picture of a cute animal (not mandatory but encouraged)
Signed-off-by: Akihiro Suda suda.akihiro@lab.ntt.co.jp