Skip to content

Commit 1573ea5

Browse files
committed
Update ctr image pull all platforms
Allows supporting fetching of all platforms while unpacking for a subset of platforms. Signed-off-by: Derek McGowan <[email protected]> (cherry picked from commit 2788604) Signed-off-by: Derek McGowan <[email protected]>
1 parent 32b594f commit 1573ea5

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

cmd/ctr/commands/images/pull.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,25 @@ command. As part of this process, we do the following:
100100
}
101101

102102
var sopts []image.StoreOpt
103-
if !context.Bool("all-platforms") {
104-
var p []ocispec.Platform
105-
for _, s := range context.StringSlice("platform") {
106-
ps, err := platforms.Parse(s)
107-
if err != nil {
108-
return fmt.Errorf("unable to parse platform %s: %w", s, err)
109-
}
110-
p = append(p, ps)
103+
104+
var p []ocispec.Platform
105+
for _, s := range context.StringSlice("platform") {
106+
ps, err := platforms.Parse(s)
107+
if err != nil {
108+
return fmt.Errorf("unable to parse platform %s: %w", s, err)
111109
}
110+
p = append(p, ps)
111+
}
112+
113+
// Set unpack configuration
114+
for _, platform := range p {
115+
sopts = append(sopts, image.WithUnpack(platform, context.String("snapshotter")))
116+
}
117+
if !context.Bool("all-platforms") {
112118
if len(p) == 0 {
113119
p = append(p, platforms.DefaultSpec())
114120
}
115121
sopts = append(sopts, image.WithPlatforms(p...))
116-
117-
// Set unpack configuration
118-
for _, platform := range p {
119-
sopts = append(sopts, image.WithUnpack(platform, context.String("snapshotter")))
120-
}
121122
}
122123
// TODO: Support unpack for all platforms..?
123124
// Pass in a *?

0 commit comments

Comments
 (0)