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"
1211 "github.com/docker/distribution/reference"
1312 "github.com/docker/docker/api/types"
1413 "github.com/docker/docker/pkg/jsonmessage"
@@ -55,28 +54,14 @@ func newInstallCommand(dockerCli command.Cli) *cobra.Command {
5554 return cmd
5655}
5756
58- type pluginRegistryService struct {
59- svc * registry.Service
60- }
61-
62- func (s pluginRegistryService ) ResolveRepository (name reference.Named ) (* registry.RepositoryInfo , error ) {
63- // FIXME(thaJeztah): do we need the Service here? Or can we just use ParseRepositoryInfo?
64- repoInfo , err := s .svc .ResolveRepository (name )
57+ func resolveRepository (name reference.Named ) (* registry.RepositoryInfo , error ) {
58+ repoInfo , err := registry .ParseRepositoryInfo (name )
6559 if repoInfo != nil {
6660 repoInfo .Class = "plugin"
6761 }
6862 return repoInfo , err
6963}
7064
71- func newRegistryService () (trust.RepositoryResolver , error ) {
72- // FIXME(thaJeztah): do we need the Service here? Or can we just use ParseRepositoryInfo? We never pass actual ServiceOptions here?
73- svc , err := registry .NewService (registry.ServiceOptions {})
74- if err != nil {
75- return nil , err
76- }
77- return pluginRegistryService {svc : svc }, nil
78- }
79-
8065func buildPullConfig (ctx context.Context , dockerCli command.Cli , opts pluginOptions , cmdName string ) (types.PluginInstallOptions , error ) {
8166 // Names with both tag and digest will be treated by the daemon
8267 // as a pull by digest with a local name for the tag
@@ -101,12 +86,7 @@ func buildPullConfig(ctx context.Context, dockerCli command.Cli, opts pluginOpti
10186 return types.PluginInstallOptions {}, errors .Errorf ("invalid name: %s" , ref .String ())
10287 }
10388
104- ctx := context .Background ()
105- svc , err := newRegistryService ()
106- if err != nil {
107- return types.PluginInstallOptions {}, err
108- }
109- trusted , err := image .TrustedReference (ctx , dockerCli , nt , svc )
89+ trusted , err := image .TrustedReference (context .Background (), dockerCli , nt , resolveRepository )
11090 if err != nil {
11191 return types.PluginInstallOptions {}, err
11292 }
0 commit comments