allow content to be pulled for specific platform(s), all platforms

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo
2018-03-12 17:31:42 -07:00
parent f334749967
commit c3cf3d7822
9 changed files with 173 additions and 38 deletions

View File

@@ -101,12 +101,20 @@ func Fetch(ref string, cliContext *cli.Context) (containerd.Image, error) {
log.G(pctx).WithField("image", ref).Debug("fetching")
labels := commands.LabelArgs(cliContext.StringSlice("label"))
img, err := client.Pull(pctx, ref,
opts := []containerd.RemoteOpt{
containerd.WithPullLabels(labels),
containerd.WithResolver(resolver),
containerd.WithImageHandler(h),
containerd.WithSchema1Conversion,
)
}
if !cliContext.Bool("all-platforms") {
for _, platform := range cliContext.StringSlice("platform") {
opts = append(opts, containerd.WithPlatform(platform))
}
}
img, err := client.Pull(pctx, ref, opts...)
stopProgress()
if err != nil {
return nil, err