File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments