Skip to content

Commit 026ef0d

Browse files
committed
[28.x] remove remaining uses of DockerCli.ContentTrustEnabled
These were already replaced for stubs in master. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 261d8bc commit 026ef0d

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

cli/command/image/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func newBuildCommand(dockerCli command.Cli) *cobra.Command {
151151
flags.SetAnnotation("target", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/buildx/build/#target"})
152152
flags.StringVar(&options.imageIDFile, "iidfile", "", "Write the image ID to the file")
153153

154-
flags.BoolVar(&options.untrusted, "disable-content-trust", !dockerCli.ContentTrustEnabled(), "Skip image verification")
154+
flags.BoolVar(&options.untrusted, "disable-content-trust", !trust.Enabled(), "Skip image verification")
155155

156156
flags.StringVar(&options.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")
157157
flags.SetAnnotation("platform", "version", []string{"1.38"})

cli/command/plugin/install.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/docker/cli/cli"
99
"github.com/docker/cli/cli/command"
1010
"github.com/docker/cli/cli/command/image"
11+
"github.com/docker/cli/cli/trust"
1112
"github.com/docker/cli/internal/jsonstream"
1213
"github.com/docker/cli/internal/prompt"
1314
"github.com/docker/cli/internal/registry"
@@ -28,9 +29,9 @@ type pluginOptions struct {
2829
untrusted bool
2930
}
3031

31-
func loadPullFlags(dockerCli command.Cli, opts *pluginOptions, flags *pflag.FlagSet) {
32+
func loadPullFlags(opts *pluginOptions, flags *pflag.FlagSet) {
3233
flags.BoolVar(&opts.grantPerms, "grant-all-permissions", false, "Grant all permissions necessary to run the plugin")
33-
flags.BoolVar(&opts.untrusted, "disable-content-trust", !dockerCli.ContentTrustEnabled(), "Skip image verification")
34+
flags.BoolVar(&opts.untrusted, "disable-content-trust", !trust.Enabled(), "Skip image verification")
3435
}
3536

3637
func newInstallCommand(dockerCli command.Cli) *cobra.Command {
@@ -49,7 +50,7 @@ func newInstallCommand(dockerCli command.Cli) *cobra.Command {
4950
}
5051

5152
flags := cmd.Flags()
52-
loadPullFlags(dockerCli, &options, flags)
53+
loadPullFlags(&options, flags)
5354
flags.BoolVar(&options.disable, "disable", false, "Do not enable the plugin on install")
5455
flags.StringVar(&options.localName, "alias", "", "Local name for plugin")
5556
return cmd

cli/command/plugin/install_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ func TestInstallContentTrustErrors(t *testing.T) {
8686

8787
for _, tc := range testCases {
8888
t.Run(tc.description, func(t *testing.T) {
89+
t.Setenv("DOCKER_CONTENT_TRUST", "true")
8990
cli := test.NewFakeCli(&fakeClient{
9091
pluginInstallFunc: func(name string, options types.PluginInstallOptions) (io.ReadCloser, error) {
9192
return nil, errors.New("should not try to install plugin")
9293
},
93-
}, test.EnableContentTrust)
94+
})
9495
cli.SetNotaryClient(tc.notaryFunc)
9596
cmd := newInstallCommand(cli)
9697
cmd.SetArgs(tc.args)

cli/command/plugin/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func newPushCommand(dockerCli command.Cli) *cobra.Command {
3333

3434
flags := cmd.Flags()
3535

36-
flags.BoolVar(&opts.untrusted, "disable-content-trust", !dockerCli.ContentTrustEnabled(), "Skip image signing")
36+
flags.BoolVar(&opts.untrusted, "disable-content-trust", !trust.Enabled(), "Skip image signing")
3737

3838
return cmd
3939
}

cli/command/plugin/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func newUpgradeCommand(dockerCli command.Cli) *cobra.Command {
3030
}
3131

3232
flags := cmd.Flags()
33-
loadPullFlags(dockerCli, &options, flags)
33+
loadPullFlags(&options, flags)
3434
flags.BoolVar(&options.skipRemoteCheck, "skip-remote-check", false, "Do not check if specified remote plugin matches existing plugin image")
3535
return cmd
3636
}

0 commit comments

Comments
 (0)