diff --git a/cmd/skopeo/copy.go b/cmd/skopeo/copy.go index e5d5b7d7..f5b2e9c5 100644 --- a/cmd/skopeo/copy.go +++ b/cmd/skopeo/copy.go @@ -89,10 +89,6 @@ func copyCmd(global *globalOptions) cli.Command { Usage: "`MANIFEST TYPE` (oci, v2s1, or v2s2) to use when saving image to directory using the 'dir:' transport (default is manifest type of source)", Value: newOptionalStringValue(&opts.format), }, - cli.BoolFlag{ - Name: "dest-compress", - Usage: "Compress tarball image layers when saving to directory using the 'dir' transport. (default is same compression type as source)", - }, }, srcFlags...), destFlags...), } } diff --git a/cmd/skopeo/utils.go b/cmd/skopeo/utils.go index 26b16993..9a7ca3b0 100644 --- a/cmd/skopeo/utils.go +++ b/cmd/skopeo/utils.go @@ -74,7 +74,6 @@ func contextFromImageOptions(c *cli.Context, opts *imageOptions) (*types.SystemC OSChoice: opts.global.overrideOS, DockerCertPath: opts.dockerCertPath, OCISharedBlobDirPath: opts.sharedBlobDir, - DirForceCompress: c.Bool(opts.flagPrefix + "compress"), AuthFilePath: c.String("authfile"), DockerDaemonHost: opts.dockerDaemonHost, DockerDaemonCertPath: opts.dockerCertPath, @@ -102,7 +101,8 @@ func contextFromImageOptions(c *cli.Context, opts *imageOptions) (*types.SystemC // imageDestOptions is a superset of imageOptions specialized for iamge destinations. type imageDestOptions struct { *imageOptions - osTreeTmpDir string // A directory to use for OSTree temporary files + osTreeTmpDir string // A directory to use for OSTree temporary files + dirForceCompression bool // Compress layers when saving to the dir: transport } // imageDestFlags prepares a collection of CLI flags writing into imageDestOptions, and the managed imageDestOptions structure. @@ -116,6 +116,11 @@ func imageDestFlags(global *globalOptions, flagPrefix, credsOptionAlias string) Usage: "`DIRECTORY` to use for OSTree temporary files", Destination: &opts.osTreeTmpDir, }, + cli.BoolFlag{ + Name: flagPrefix + "compress", + Usage: "Compress tarball image layers when saving to directory using the 'dir' transport. (default is same compression type as source)", + Destination: &opts.dirForceCompression, + }, }...), &opts } @@ -128,6 +133,7 @@ func contextFromImageDestOptions(c *cli.Context, opts *imageDestOptions) (*types } ctx.OSTreeTmpDirPath = opts.osTreeTmpDir + ctx.DirForceCompress = opts.dirForceCompression return ctx, err } diff --git a/cmd/skopeo/utils_test.go b/cmd/skopeo/utils_test.go index 3934c465..615a77f8 100644 --- a/cmd/skopeo/utils_test.go +++ b/cmd/skopeo/utils_test.go @@ -71,14 +71,6 @@ func TestContextFromImageOptions(t *testing.T) { require.NoError(t, err) assert.Equal(t, &types.SystemContext{}, res) - // Explicitly set everything to default, except for when the default is “not present” - c, opts = fakeImageContext(t, "copy", "dest-", []string{}, []string{ - "--dest-compress=false", - }) - res, err = contextFromImageOptions(c, opts) - require.NoError(t, err) - assert.Equal(t, &types.SystemContext{}, res) - // Set everything to non-default values. c, opts = fakeImageContext(t, "copy", "dest-", []string{ "--registries.d", "/srv/registries.d", @@ -88,7 +80,6 @@ func TestContextFromImageOptions(t *testing.T) { "--authfile", "/srv/authfile", "--dest-cert-dir", "/srv/cert-dir", "--dest-shared-blob-dir", "/srv/shared-blob-dir", - "--dest-compress=true", "--dest-daemon-host", "daemon-host.example.com", "--dest-tls-verify=false", "--dest-creds", "creds-user:creds-password", @@ -107,7 +98,6 @@ func TestContextFromImageOptions(t *testing.T) { DockerDaemonCertPath: "/srv/cert-dir", DockerDaemonHost: "daemon-host.example.com", DockerDaemonInsecureSkipTLSVerify: true, - DirForceCompress: true, }, res) // Global/per-command tlsVerify behavior