-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli/trust: TagTrusted: lazily request APIClient
Commit e37d814 moved the image.TagTrusted function to the trust package, but changed the signature slightly to accept an API client, instead of requiring the command.Cli. However, this could result in situations where the Client obtained from the CLI was not correctly initialized, resulting in failures in our e2e test; === FAIL: e2e/global TestPromptExitCode/plugin_upgrade (9.14s) cli_test.go:203: assertion failed: Command: docker plugin push registry:5000/plugin-content-trust-upgrade:next ExitCode: 1 Error: exit status 1 Stdout: The push refers to repository [registry:5000/plugin-content-trust-upgrade] 24ec5b45d59b: Preparing 6a594992d358: Preparing 224414d1b129: Preparing 24ec5b45d59b: Preparing 6a594992d358: Preparing 224414d1b129: Preparing Stderr: error pushing plugin: failed to do request: Head "https://registry:5000/v2/plugin-content-trust-upgrade/blobs/sha256:6a594992d358facbbc4ab134bbbba77cb91e0adee6ff0d6103403ff94a9b796c": http: server gave HTTP response to HTTPS client Failures: ExitCode was 1 expected 0 Expected no error This patch changes the signature to accept an "APIClientProvider" so that the Client is obtained the moment when used. We should look what exactly causes this situation, and if we can make sure that requesting the `Client()` will always produce the client with the expected configuration. WARNING: looks like the test is still flaky after this change, so it may just be a bad test, or tests affecting each-other (same port, but different config?). That said; these changes may still be ok to include. Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information
Showing
5 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package container | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/distribution/reference" | ||
"github.com/docker/cli/cli/command" | ||
"github.com/docker/cli/cli/trust" | ||
) | ||
|
||
func tagTrusted(ctx context.Context, cli command.Cli, trustedRef reference.Canonical, ref reference.NamedTagged) error { | ||
return trust.TagTrusted(ctx, cli, cli.Err(), trustedRef, ref) | ||
} |
This file contains 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
This file contains 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
This file contains 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