diff --git a/cmd/crane/cmd/root.go b/cmd/crane/cmd/root.go index 31d997ab5..dd8cb780c 100644 --- a/cmd/crane/cmd/root.go +++ b/cmd/crane/cmd/root.go @@ -38,6 +38,7 @@ var Root = New(use, short, []crane.Option{}) func New(use, short string, options []crane.Option) *cobra.Command { verbose := false insecure := false + ndlayers := false platform := &platformValue{} root := &cobra.Command{ @@ -55,6 +56,9 @@ func New(use, short string, options []crane.Option) *cobra.Command { if insecure { options = append(options, crane.Insecure) } + if ndlayers { + options = append(options, crane.WithNondistributable()) + } if Version != "" { binary := "crane" if len(os.Args[0]) != 0 { @@ -113,6 +117,7 @@ func New(use, short string, options []crane.Option) *cobra.Command { root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable debug logs") root.PersistentFlags().BoolVar(&insecure, "insecure", false, "Allow image references to be fetched without TLS") + root.PersistentFlags().BoolVar(&ndlayers, "allow-nondistributable-artifacts", false, "Allow pushing non-distributable (foreign) layers") root.PersistentFlags().Var(platform, "platform", "Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64).") return root diff --git a/cmd/crane/doc/crane.md b/cmd/crane/doc/crane.md index b58b7bdfe..84e9dbc7e 100644 --- a/cmd/crane/doc/crane.md +++ b/cmd/crane/doc/crane.md @@ -9,10 +9,11 @@ crane [flags] ### Options ``` - -h, --help help for crane - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + -h, --help help for crane + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_append.md b/cmd/crane/doc/crane_append.md index e57719f43..a6690a301 100644 --- a/cmd/crane/doc/crane_append.md +++ b/cmd/crane/doc/crane_append.md @@ -30,9 +30,10 @@ crane append [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_auth.md b/cmd/crane/doc/crane_auth.md index 8e9d49e63..6eb8fc8fc 100644 --- a/cmd/crane/doc/crane_auth.md +++ b/cmd/crane/doc/crane_auth.md @@ -15,9 +15,10 @@ crane auth [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_auth_get.md b/cmd/crane/doc/crane_auth_get.md index ce4fe3c1b..2265b84f0 100644 --- a/cmd/crane/doc/crane_auth_get.md +++ b/cmd/crane/doc/crane_auth_get.md @@ -23,9 +23,10 @@ crane auth get [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_auth_login.md b/cmd/crane/doc/crane_auth_login.md index f17f840a1..1fec4231c 100644 --- a/cmd/crane/doc/crane_auth_login.md +++ b/cmd/crane/doc/crane_auth_login.md @@ -25,9 +25,10 @@ crane auth login [OPTIONS] [SERVER] [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_blob.md b/cmd/crane/doc/crane_blob.md index 2b969076a..36f615a62 100644 --- a/cmd/crane/doc/crane_blob.md +++ b/cmd/crane/doc/crane_blob.md @@ -21,9 +21,10 @@ crane blob ubuntu@sha256:4c1d20cdee96111c8acf1858b62655a37ce81ae48648993542b7ac3 ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_catalog.md b/cmd/crane/doc/crane_catalog.md index bed92e673..cf55bb6c9 100644 --- a/cmd/crane/doc/crane_catalog.md +++ b/cmd/crane/doc/crane_catalog.md @@ -15,9 +15,10 @@ crane catalog [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_config.md b/cmd/crane/doc/crane_config.md index 3d477eff5..5d7fa5af4 100644 --- a/cmd/crane/doc/crane_config.md +++ b/cmd/crane/doc/crane_config.md @@ -15,9 +15,10 @@ crane config IMAGE [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_copy.md b/cmd/crane/doc/crane_copy.md index af0710551..8e7e1a89c 100644 --- a/cmd/crane/doc/crane_copy.md +++ b/cmd/crane/doc/crane_copy.md @@ -15,9 +15,10 @@ crane copy SRC DST [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_delete.md b/cmd/crane/doc/crane_delete.md index 25ac161d4..7932ea277 100644 --- a/cmd/crane/doc/crane_delete.md +++ b/cmd/crane/doc/crane_delete.md @@ -15,9 +15,10 @@ crane delete IMAGE [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_digest.md b/cmd/crane/doc/crane_digest.md index e738d735d..3e6b0156b 100644 --- a/cmd/crane/doc/crane_digest.md +++ b/cmd/crane/doc/crane_digest.md @@ -16,9 +16,10 @@ crane digest IMAGE [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_export.md b/cmd/crane/doc/crane_export.md index 162da21bf..ca10c56c0 100644 --- a/cmd/crane/doc/crane_export.md +++ b/cmd/crane/doc/crane_export.md @@ -28,9 +28,10 @@ crane export IMAGE|- TARBALL|- [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_flatten.md b/cmd/crane/doc/crane_flatten.md index ccad400ea..68e6bc645 100644 --- a/cmd/crane/doc/crane_flatten.md +++ b/cmd/crane/doc/crane_flatten.md @@ -16,9 +16,10 @@ crane flatten [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_ls.md b/cmd/crane/doc/crane_ls.md index 01104bd07..11248721b 100644 --- a/cmd/crane/doc/crane_ls.md +++ b/cmd/crane/doc/crane_ls.md @@ -15,9 +15,10 @@ crane ls REPO [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_manifest.md b/cmd/crane/doc/crane_manifest.md index 831b57826..3d61b4e21 100644 --- a/cmd/crane/doc/crane_manifest.md +++ b/cmd/crane/doc/crane_manifest.md @@ -15,9 +15,10 @@ crane manifest IMAGE [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_mutate.md b/cmd/crane/doc/crane_mutate.md index be6d28f94..0174b09d8 100644 --- a/cmd/crane/doc/crane_mutate.md +++ b/cmd/crane/doc/crane_mutate.md @@ -25,9 +25,10 @@ crane mutate [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_pull.md b/cmd/crane/doc/crane_pull.md index e10dc9d13..1ef50f684 100644 --- a/cmd/crane/doc/crane_pull.md +++ b/cmd/crane/doc/crane_pull.md @@ -17,9 +17,10 @@ crane pull IMAGE TARBALL [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_push.md b/cmd/crane/doc/crane_push.md index f88a353ae..64bacf60e 100644 --- a/cmd/crane/doc/crane_push.md +++ b/cmd/crane/doc/crane_push.md @@ -21,9 +21,10 @@ crane push PATH IMAGE [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_rebase.md b/cmd/crane/doc/crane_rebase.md index 753928c04..e30f07875 100644 --- a/cmd/crane/doc/crane_rebase.md +++ b/cmd/crane/doc/crane_rebase.md @@ -20,9 +20,10 @@ crane rebase [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_tag.md b/cmd/crane/doc/crane_tag.md index 78cec5ede..5433467f5 100644 --- a/cmd/crane/doc/crane_tag.md +++ b/cmd/crane/doc/crane_tag.md @@ -34,9 +34,10 @@ crane tag ubuntu v1 ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_validate.md b/cmd/crane/doc/crane_validate.md index 0ce6f7a5a..cff22f80d 100644 --- a/cmd/crane/doc/crane_validate.md +++ b/cmd/crane/doc/crane_validate.md @@ -18,9 +18,10 @@ crane validate [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/cmd/crane/doc/crane_version.md b/cmd/crane/doc/crane_version.md index a23e2b629..09727924f 100644 --- a/cmd/crane/doc/crane_version.md +++ b/cmd/crane/doc/crane_version.md @@ -22,9 +22,10 @@ crane version [flags] ### Options inherited from parent commands ``` - --insecure Allow image references to be fetched without TLS - --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) - -v, --verbose Enable debug logs + --allow-nondistributable-artifacts Allow pushing non-distributable (foreign) layers + --insecure Allow image references to be fetched without TLS + --platform platform Specifies the platform in the form os/arch[/variant][:osversion] (e.g. linux/amd64). (default all) + -v, --verbose Enable debug logs ``` ### SEE ALSO diff --git a/pkg/crane/options.go b/pkg/crane/options.go index 6e1177e4d..2f95e0556 100644 --- a/pkg/crane/options.go +++ b/pkg/crane/options.go @@ -108,6 +108,14 @@ func WithUserAgent(ua string) Option { } } +// WithNondistributable is an option that allows pushing non-distributable +// layers. +func WithNondistributable() Option { + return func(o *Options) { + o.Remote = append(o.Remote, remote.WithNondistributable) + } +} + // WithContext is a functional option for setting the context. func WithContext(ctx context.Context) Option { return func(o *Options) {