Skip to content

Commit

Permalink
Merge pull request #778 from giuseppe/copier-accept-compression
Browse files Browse the repository at this point in the history
libimage: accept CompressionFormat/CompressionLevel
  • Loading branch information
openshift-merge-robot committed Sep 21, 2021
2 parents f045f1f + a74e54a commit 8a416a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libimage/copier.go
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/containers/common/pkg/retry"
"github.com/containers/image/v5/copy"
"github.com/containers/image/v5/docker/reference"
"github.com/containers/image/v5/pkg/compression"
"github.com/containers/image/v5/signature"
storageTransport "github.com/containers/image/v5/storage"
"github.com/containers/image/v5/types"
Expand Down Expand Up @@ -40,6 +41,10 @@ type CopyOptions struct {
// Allows for customizing the destination reference lookup. This can
// be used to use custom blob caches.
DestinationLookupReferenceFunc LookupReferenceFunc
// CompressionFormat is the format to use for the compression of the blobs
CompressionFormat *compression.Algorithm
// CompressionLevel specifies what compression level is used
CompressionLevel *int

// containers-auth.json(5) file to use when authenticating against
// container registries.
Expand Down Expand Up @@ -242,6 +247,14 @@ func (r *Runtime) newCopier(options *CopyOptions) (*copier, error) {
c.systemContext.DockerCertPath = options.CertDirPath
}

if options.CompressionFormat != nil {
c.systemContext.CompressionFormat = options.CompressionFormat
}

if options.CompressionLevel != nil {
c.systemContext.CompressionLevel = options.CompressionLevel
}

policy, err := signature.DefaultPolicy(c.systemContext)
if err != nil {
return nil, err
Expand Down

0 comments on commit 8a416a1

Please sign in to comment.