Update client Image to have configurable platform

Separate Fetch and Pull commands in client to distinguish
between platform specific and non-platform specific operations.
`ctr images pull` with all platforms will now unpack all platforms.
`ctr content fetch` now supports platform flags.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2018-07-13 16:11:50 -07:00
parent fb1084d9cc
commit 3a916a0f67
7 changed files with 151 additions and 60 deletions

View File

@@ -111,7 +111,7 @@ func TestMain(m *testing.M) {
}).Info("running tests against containerd")
// pull a seed image
if _, err = client.Pull(ctx, testImage, WithPullUnpack, WithPlatform(platforms.Default())); err != nil {
if _, err = client.Pull(ctx, testImage, WithPullUnpack); err != nil {
ctrd.Stop()
ctrd.Wait()
fmt.Fprintf(os.Stderr, "%s: %s\n", err, buf.String())
@@ -198,11 +198,11 @@ func TestImagePullAllPlatforms(t *testing.T) {
defer cancel()
cs := client.ContentStore()
img, err := client.Pull(ctx, testImage)
img, err := client.Fetch(ctx, testImage)
if err != nil {
t.Fatal(err)
}
index := img.Target()
index := img.Target
manifests, err := images.Children(ctx, cs, index)
if err != nil {
t.Fatal(err)
@@ -246,12 +246,12 @@ func TestImagePullSomePlatforms(t *testing.T) {
opts = append(opts, WithPlatform(platform))
}
img, err := client.Pull(ctx, "docker.io/library/busybox:latest", opts...)
img, err := client.Fetch(ctx, "docker.io/library/busybox:latest", opts...)
if err != nil {
t.Fatal(err)
}
index := img.Target()
index := img.Target
manifests, err := images.Children(ctx, cs, index)
if err != nil {
t.Fatal(err)