From 2788604e496c4010423ce47d693876605168dc3c Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Thu, 9 May 2024 20:48:38 -0700 Subject: [PATCH] Update ctr image pull all platforms Allows supporting fetching of all platforms while unpacking for a subset of platforms. Signed-off-by: Derek McGowan --- cmd/ctr/commands/images/pull.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/ctr/commands/images/pull.go b/cmd/ctr/commands/images/pull.go index 6d8d8ea5a..0b0de7c05 100644 --- a/cmd/ctr/commands/images/pull.go +++ b/cmd/ctr/commands/images/pull.go @@ -106,20 +106,20 @@ command. As part of this process, we do the following: } var sopts []image.StoreOpt + p, err := platforms.ParseAll(context.StringSlice("platform")) + if err != nil { + return err + } + + // Set unpack configuration + for _, platform := range p { + sopts = append(sopts, image.WithUnpack(platform, context.String("snapshotter"))) + } if !context.Bool("all-platforms") { - p, err := platforms.ParseAll(context.StringSlice("platform")) - if err != nil { - return err - } if len(p) == 0 { p = append(p, platforms.DefaultSpec()) } sopts = append(sopts, image.WithPlatforms(p...)) - - // Set unpack configuration - for _, platform := range p { - sopts = append(sopts, image.WithUnpack(platform, context.String("snapshotter"))) - } } // TODO: Support unpack for all platforms..? // Pass in a *?