client: Allow setting image labels on Pull() and Import()

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure
2017-09-19 20:47:00 -07:00
parent b24acea276
commit df82159f4d
7 changed files with 84 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ not use this implementation as a guide. The end goal should be having metadata,
content and snapshots ready for a direct use via the 'ctr run'.
Most of this is experimental and there are few leaps to make this work.`,
Flags: registryFlags,
Flags: append(registryFlags, labelFlag),
Action: func(clicontext *cli.Context) error {
var (
ref = clicontext.Args().First()
@@ -84,8 +84,13 @@ func fetch(ctx context.Context, ref string, clicontext *cli.Context) (containerd
})
log.G(pctx).WithField("image", ref).Debug("fetching")
img, err := client.Pull(pctx, ref, containerd.WithResolver(resolver), containerd.WithImageHandler(h), containerd.WithSchema1Conversion)
labels := labelArgs(clicontext.StringSlice("label"))
img, err := client.Pull(pctx, ref,
containerd.WithPullLabels(labels),
containerd.WithResolver(resolver),
containerd.WithImageHandler(h),
containerd.WithSchema1Conversion,
)
stopProgress()
if err != nil {
return nil, err