Transfer: Push: Enable to specify platforms

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
Kohei Tokunaga
2024-06-04 09:48:17 +09:00
parent 21c244d436
commit 5611fdd4af
4 changed files with 22 additions and 16 deletions

View File

@@ -112,7 +112,14 @@ var pushCommand = &cli.Command{
if err != nil {
return err
}
is := image.NewStore(local)
var p []ocispec.Platform
if pss := context.StringSlice("platform"); len(pss) > 0 {
p, err = platforms.ParseAll(pss)
if err != nil {
return fmt.Errorf("invalid platform %v: %w", pss, err)
}
}
is := image.NewStore(local, image.WithPlatforms(p...))
pf, done := ProgressHandler(ctx, os.Stdout)
defer done()