From b32638e21bd467af51a2a897ccb4a057ffd43de3 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Tue, 29 Aug 2023 17:18:26 -0700 Subject: [PATCH] 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 --- cmd/ctr/commands/content/fetch.go | 11 ++++++++--- cmd/ctr/commands/images/pull.go | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cmd/ctr/commands/content/fetch.go b/cmd/ctr/commands/content/fetch.go index b45a5c76f..d7ccb7ffa 100644 --- a/cmd/ctr/commands/content/fetch.go +++ b/cmd/ctr/commands/content/fetch.go @@ -68,8 +68,13 @@ Most of this is experimental and there are few leaps to make this work.`, Usage: "Pull content from all platforms", }, cli.BoolFlag{ - Name: "all-metadata", - Usage: "Pull metadata for all platforms", + Name: "all-metadata", + 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{ Name: "metadata-only", @@ -141,7 +146,7 @@ func NewFetchConfig(ctx context.Context, clicontext *cli.Context) (*FetchConfig, config.AllMetadata = true // Any with an empty set is None config.PlatformMatcher = platforms.Any() - } else if clicontext.Bool("all-metadata") { + } else if !clicontext.Bool("skip-metadata") { config.AllMetadata = true } diff --git a/cmd/ctr/commands/images/pull.go b/cmd/ctr/commands/images/pull.go index 24ff6d404..09b35d702 100644 --- a/cmd/ctr/commands/images/pull.go +++ b/cmd/ctr/commands/images/pull.go @@ -63,8 +63,13 @@ command. As part of this process, we do the following: Usage: "Pull content and metadata from all platforms", }, cli.BoolFlag{ - Name: "all-metadata", - Usage: "Pull metadata for all platforms", + Name: "all-metadata", + 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{ Name: "print-chainid", @@ -123,7 +128,7 @@ command. As part of this process, we do the following: // Any with an empty set is None // TODO: Specify way to specify not default platform // config.PlatformMatcher = platforms.Any() - } else if context.Bool("all-metadata") { + } else if !context.Bool("skip-metadata") { sopts = append(sopts, image.WithAllMetadata) }