Skip to content

Commit 4c11d75

Browse files
committed
ctr pull unpack for default platform using transfer service
Signed-off-by: Jin Dong <[email protected]>
1 parent 566f9f4 commit 4c11d75

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

cmd/ctr/commands/images/pull.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,20 @@ command. As part of this process, we do the following:
119119
if err != nil {
120120
return err
121121
}
122-
123-
// Set unpack configuration
124-
for _, platform := range p {
125-
sopts = append(sopts, image.WithUnpack(platform, cliContext.String("snapshotter")))
122+
allPlatforms := cliContext.Bool("all-platforms")
123+
if len(p) > 0 && allPlatforms {
124+
return errors.New("cannot specify both --platform and --all-platforms")
126125
}
127-
if !cliContext.Bool("all-platforms") {
128-
if len(p) == 0 {
129-
p = append(p, platforms.DefaultSpec())
130-
}
131-
sopts = append(sopts, image.WithPlatforms(p...))
126+
if len(p) == 0 && !allPlatforms {
127+
p = append(p, platforms.DefaultSpec())
132128
}
129+
// we use an empty `Platform` slice to indicate that we want to pull all platforms
130+
sopts = append(sopts, image.WithPlatforms(p...))
133131
// TODO: Support unpack for all platforms..?
134132
// Pass in a *?
133+
for _, platform := range p {
134+
sopts = append(sopts, image.WithUnpack(platform, cliContext.String("snapshotter")))
135+
}
135136

136137
if cliContext.Bool("metadata-only") {
137138
sopts = append(sopts, image.WithAllMetadata)

0 commit comments

Comments
 (0)