From e6608461d540aa873a44098829489588af748493 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Tue, 2 Jun 2020 16:26:50 -0600 Subject: [PATCH 1/2] types: separate out ostree transport flags This isn't a docker flag; it deserves its own heading. Signed-off-by: Tycho Andersen --- types/types.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/types.go b/types/types.go index d469e03b53..6c14037179 100644 --- a/types/types.go +++ b/types/types.go @@ -566,6 +566,8 @@ type SystemContext struct { DockerDisableV1Ping bool // If true, dockerImageDestination.SupportedManifestMIMETypes will omit the Schema1 media types from the supported list DockerDisableDestSchema1MIMETypes bool + + // === ostree.Transport overrides === // Directory to use for OSTree temporary files OSTreeTmpDirPath string From 6b6e76ccd33e85c895dfe49e4b973f0d678be4e0 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Fri, 12 Jul 2019 10:23:47 -0600 Subject: [PATCH 2/2] docker: allow uncompressed layers We're interested in sending uncompressed layers to a docker registry, so let's add a flag to support this. Signed-off-by: Tycho Andersen --- docker/docker_image_dest.go | 19 +++++++++++++++---- types/types.go | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docker/docker_image_dest.go b/docker/docker_image_dest.go index 979100ee38..7ddea2c098 100644 --- a/docker/docker_image_dest.go +++ b/docker/docker_image_dest.go @@ -30,8 +30,10 @@ import ( ) type dockerImageDestination struct { - ref dockerReference - c *dockerClient + ref dockerReference + c *dockerClient + acceptUncompressedLayers bool + // State manifestDigest digest.Digest // or "" if not yet known. } @@ -42,10 +44,16 @@ func newImageDestination(sys *types.SystemContext, ref dockerReference) (types.I if err != nil { return nil, err } - return &dockerImageDestination{ + d := &dockerImageDestination{ ref: ref, c: c, - }, nil + } + + if sys != nil { + d.acceptUncompressedLayers = sys.DockerAcceptUncompressedLayers + } + + return d, nil } // Reference returns the reference used to set up this destination. Note that this should directly correspond to user's intent, @@ -89,6 +97,9 @@ func (d *dockerImageDestination) SupportsSignatures(ctx context.Context) error { } func (d *dockerImageDestination) DesiredLayerCompression() types.LayerCompression { + if d.acceptUncompressedLayers { + return types.PreserveOriginal + } return types.Compress } diff --git a/types/types.go b/types/types.go index 6c14037179..e1a7f4e7dc 100644 --- a/types/types.go +++ b/types/types.go @@ -566,6 +566,8 @@ type SystemContext struct { DockerDisableV1Ping bool // If true, dockerImageDestination.SupportedManifestMIMETypes will omit the Schema1 media types from the supported list DockerDisableDestSchema1MIMETypes bool + // Allow uncompressed image layers in Docker images + DockerAcceptUncompressedLayers bool // === ostree.Transport overrides === // Directory to use for OSTree temporary files