ctr: pull or fetch image metadata by default

The metadata is small and useful for viewing all platforms
for an image and enabling push back to the same registry.

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan 2023-08-29 17:18:26 -07:00
parent 20f79300cf
commit b32638e21b
No known key found for this signature in database
GPG Key ID: F58C5D0A4405ACDB
2 changed files with 16 additions and 6 deletions

View File

@ -69,7 +69,12 @@ Most of this is experimental and there are few leaps to make this work.`,
}, },
cli.BoolFlag{ cli.BoolFlag{
Name: "all-metadata", Name: "all-metadata",
Usage: "Pull metadata for all platforms", Usage: "(Deprecated: use skip-metadata) Pull metadata for all platforms",
Hidden: true,
},
cli.BoolFlag{
Name: "skip-metadata",
Usage: "Skips metadata for unused platforms (Image may be unable to be pushed without metadata)",
}, },
cli.BoolFlag{ cli.BoolFlag{
Name: "metadata-only", Name: "metadata-only",
@ -141,7 +146,7 @@ func NewFetchConfig(ctx context.Context, clicontext *cli.Context) (*FetchConfig,
config.AllMetadata = true config.AllMetadata = true
// Any with an empty set is None // Any with an empty set is None
config.PlatformMatcher = platforms.Any() config.PlatformMatcher = platforms.Any()
} else if clicontext.Bool("all-metadata") { } else if !clicontext.Bool("skip-metadata") {
config.AllMetadata = true config.AllMetadata = true
} }

View File

@ -64,7 +64,12 @@ command. As part of this process, we do the following:
}, },
cli.BoolFlag{ cli.BoolFlag{
Name: "all-metadata", Name: "all-metadata",
Usage: "Pull metadata for all platforms", Usage: "(Deprecated: use skip-metadata) Pull metadata for all platforms",
Hidden: true,
},
cli.BoolFlag{
Name: "skip-metadata",
Usage: "Skips metadata for unused platforms (Image may be unable to be pushed without metadata)",
}, },
cli.BoolFlag{ cli.BoolFlag{
Name: "print-chainid", Name: "print-chainid",
@ -123,7 +128,7 @@ command. As part of this process, we do the following:
// Any with an empty set is None // Any with an empty set is None
// TODO: Specify way to specify not default platform // TODO: Specify way to specify not default platform
// config.PlatformMatcher = platforms.Any() // config.PlatformMatcher = platforms.Any()
} else if context.Bool("all-metadata") { } else if !context.Bool("skip-metadata") {
sopts = append(sopts, image.WithAllMetadata) sopts = append(sopts, image.WithAllMetadata)
} }