From ab337d86871607e83ce6f0b3b664bc7c4fb2ce19 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 21 Sep 2021 14:13:59 +0200 Subject: [PATCH] copier: add OciAcceptUncompressedLayers option Add an option to allow for accepting uncompressed layers when copying OCI images. Context: github.com/containers/podman/issues/11613 Signed-off-by: Valentin Rothberg --- libimage/copier.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libimage/copier.go b/libimage/copier.go index 7396ed4a1..25c11bb3c 100644 --- a/libimage/copier.go +++ b/libimage/copier.go @@ -70,6 +70,8 @@ type CopyOptions struct { // types. Short forms (e.g., oci, v2s2) used by some tools are not // supported. ManifestMIMEType string + // Accept uncompressed layers when copying OCI images. + OciAcceptUncompressedLayers bool // If OciEncryptConfig is non-nil, it indicates that an image should be // encrypted. The encryption options is derived from the construction // of EncryptConfig object. Note: During initial encryption process of @@ -255,6 +257,10 @@ func (r *Runtime) newCopier(options *CopyOptions) (*copier, error) { c.systemContext.CompressionLevel = options.CompressionLevel } + // NOTE: for the sake of consistency it's called Oci* in the CopyOptions. + c.systemContext.OCIAcceptUncompressedLayers = options.OciAcceptUncompressedLayers + + policy, err := signature.DefaultPolicy(c.systemContext) if err != nil { return nil, err