(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions)
| 88 | } |
| 89 | |
| 90 | func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions) error { |
| 91 | if err := validateTag(options.repoName); err != nil { |
| 92 | return err |
| 93 | } |
| 94 | |
| 95 | absContextDir, err := validateContextDir(options.context) |
| 96 | if err != nil { |
| 97 | return err |
| 98 | } |
| 99 | |
| 100 | if err := validateConfig(options.context); err != nil { |
| 101 | return err |
| 102 | } |
| 103 | |
| 104 | comp := compression.None |
| 105 | if options.compress { |
| 106 | logrus.Debugf("compression enabled") |
| 107 | comp = compression.Gzip |
| 108 | } |
| 109 | |
| 110 | createCtx, err := archive.TarWithOptions(absContextDir, &archive.TarOptions{ |
| 111 | Compression: comp, |
| 112 | }) |
| 113 | if err != nil { |
| 114 | return err |
| 115 | } |
| 116 | |
| 117 | _, err = dockerCli.Client().PluginCreate(ctx, createCtx, client.PluginCreateOptions{RepoName: options.repoName}) |
| 118 | if err != nil { |
| 119 | return err |
| 120 | } |
| 121 | _, _ = fmt.Fprintln(dockerCli.Out(), options.repoName) |
| 122 | return nil |
| 123 | } |
no test coverage detected
searching dependent graphs…