Skip to content

Commit

Permalink
Merge pull request #3259 from BenTheElder/no-unpack
Browse files Browse the repository at this point in the history
ctr images import: add --no-unpack option
  • Loading branch information
estesp committed May 5, 2019
2 parents 82f2ac7 + cb7c780 commit d71c7ad
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions cmd/ctr/commands/images/import.go
Expand Up @@ -68,6 +68,10 @@ If foobar.tar contains an OCI ref named "latest" and anonymous ref "sha256:deadb
Name: "all-platforms",
Usage: "imports content for all platforms, false by default",
},
cli.BoolFlag{
Name: "no-unpack",
Usage: "skip unpacking the images, false by default",
},
}, commands.SnapshotterFlags...),

Action: func(context *cli.Context) error {
Expand Down Expand Up @@ -119,19 +123,21 @@ If foobar.tar contains an OCI ref named "latest" and anonymous ref "sha256:deadb
return closeErr
}

log.G(ctx).Debugf("unpacking %d images", len(imgs))
if !context.Bool("no-unpack") {
log.G(ctx).Debugf("unpacking %d images", len(imgs))

for _, img := range imgs {
// TODO: Allow configuration of the platform
image := containerd.NewImage(client, img)
for _, img := range imgs {
// TODO: Allow configuration of the platform
image := containerd.NewImage(client, img)

// TODO: Show unpack status
fmt.Printf("unpacking %s (%s)...", img.Name, img.Target.Digest)
err = image.Unpack(ctx, context.String("snapshotter"))
if err != nil {
return err
// TODO: Show unpack status
fmt.Printf("unpacking %s (%s)...", img.Name, img.Target.Digest)
err = image.Unpack(ctx, context.String("snapshotter"))
if err != nil {
return err
}
fmt.Println("done")
}
fmt.Println("done")
}
return nil
},
Expand Down

0 comments on commit d71c7ad

Please sign in to comment.