1
0
mirror of https://github.com/containers/image.git synced 2025-04-18 19:44:05 +03:00

Issue #475 Add flag for image compress layer for oci destination

Signed-off-by: Praveen Kumar <kumarpraveen.nitdgp@gmail.com>
This commit is contained in:
Praveen Kumar 2018-07-12 16:24:16 +05:30
parent 216acb1bcd
commit 58b84676d0
3 changed files with 13 additions and 3 deletions

3
.gitignore vendored
View File

@ -7,3 +7,6 @@ tools.timestamp
# Visual Studio Code
.vscode/*
# trash
trash.lock

View File

@ -18,9 +18,10 @@ import (
)
type ociImageDestination struct {
ref ociReference
index imgspecv1.Index
sharedBlobDir string
ref ociReference
index imgspecv1.Index
sharedBlobDir string
acceptUncompressedLayers bool
}
// newImageDestination returns an ImageDestination for writing to an existing directory.
@ -43,6 +44,7 @@ func newImageDestination(sys *types.SystemContext, ref ociReference) (types.Imag
d := &ociImageDestination{ref: ref, index: *index}
if sys != nil {
d.sharedBlobDir = sys.OCISharedBlobDirPath
d.acceptUncompressedLayers = sys.OCIAcceptUncompressedLayers
}
if err := ensureDirectoryExists(d.ref.dir); err != nil {
@ -81,6 +83,9 @@ func (d *ociImageDestination) SupportsSignatures(ctx context.Context) error {
}
func (d *ociImageDestination) DesiredLayerCompression() types.LayerCompression {
if d.acceptUncompressedLayers {
return types.PreserveOriginal
}
return types.Compress
}

View File

@ -364,6 +364,8 @@ type SystemContext struct {
OCIInsecureSkipTLSVerify bool
// If not "", use a shared directory for storing blobs rather than within OCI layouts
OCISharedBlobDirPath string
// Allow UnCompress image layer for OCI image layer
OCIAcceptUncompressedLayers bool
// === docker.Transport overrides ===
// If not "", a directory containing a CA certificate (ending with ".crt"),