Skip to content

Commit

Permalink
copy: add --dest-compress-format and --dest-compress-level
Browse files Browse the repository at this point in the history
add the possibility to specify the format and the level to use when
compressing blobs.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jun 11, 2019
1 parent 96be1bb commit f41b698
Show file tree
Hide file tree
Showing 27 changed files with 513 additions and 158 deletions.
14 changes: 14 additions & 0 deletions cmd/skopeo/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ type imageDestOptions struct {
*imageOptions
osTreeTmpDir string // A directory to use for OSTree temporary files
dirForceCompression bool // Compress layers when saving to the dir: transport
compressionFormat string // Format to use for the compression
compressionLevel int // Level to use for the compression
}

// imageDestFlags prepares a collection of CLI flags writing into imageDestOptions, and the managed imageDestOptions structure.
Expand All @@ -173,6 +175,16 @@ func imageDestFlags(global *globalOptions, shared *sharedImageOptions, flagPrefi
Usage: "Compress tarball image layers when saving to directory using the 'dir' transport. (default is same compression type as source)",
Destination: &opts.dirForceCompression,
},
cli.StringFlag{
Name: flagPrefix + "compress-format",
Usage: "`FORMAT` to use for the compression",
Destination: &opts.compressionFormat,
},
cli.IntFlag{
Name: flagPrefix + "compress-level",
Usage: "`LEVEL` to use for the compression",
Destination: &opts.compressionLevel,
},
}...), &opts
}

Expand All @@ -186,6 +198,8 @@ func (opts *imageDestOptions) newSystemContext() (*types.SystemContext, error) {

ctx.OSTreeTmpDirPath = opts.osTreeTmpDir
ctx.DirForceCompress = opts.dirForceCompression
ctx.CompressionFormat = opts.compressionFormat
ctx.CompressionLevel = opts.compressionLevel
return ctx, err
}

Expand Down
4 changes: 4 additions & 0 deletions docs/skopeo-copy.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ If the authorization state is not found there, $HOME/.docker/config.json is chec

Existing signatures, if any, are preserved as well.

**--dest-compress-format** _format_ Specifies the compression format to use.

**--dest-compress-level** _format_ Specifies the compression level to use.

## EXAMPLES

To copy the layers of the docker.io busybox image to a local directory:
Expand Down
5 changes: 3 additions & 2 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
github.com/urfave/cli v1.20.0
github.com/kr/pretty v0.1.0
github.com/kr/text v0.1.0
github.com/containers/image 2c0349c99af7d90694b3faa0e9bde404d407b145
github.com/containers/buildah 810efa340ab43753034e2ed08ec290e4abab7e72
github.com/vbauerster/mpb v3.3.4
github.com/mattn/go-isatty v0.0.4
github.com/VividCortex/ewma v1.1.1
golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
github.com/containers/storage v1.12.3
github.com/containers/storage zstd https://github.com/giuseppe/storage
github.com/containers/image zstd https://github.com/giuseppe/image
github.com/sirupsen/logrus v1.0.0
github.com/go-check/check v1
github.com/stretchr/testify v1.1.3
Expand Down Expand Up @@ -65,3 +65,4 @@ github.com/syndtr/gocapability d98352740cb2c55f81556b63d4a1ec64c5a319c2
github.com/klauspost/pgzip v1.2.1
github.com/klauspost/compress v1.4.1
github.com/klauspost/cpuid v1.2.0
github.com/DataDog/zstd 1.x
69 changes: 54 additions & 15 deletions vendor/github.com/containers/image/copy/copy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions vendor/github.com/containers/image/docker/docker_image_src.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions vendor/github.com/containers/image/docker/reference/normalize.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vendor/github.com/containers/image/docker/reference/regexp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f41b698

Please sign in to comment.