diff --git a/cmd/skopeo/copy.go b/cmd/skopeo/copy.go index fc6507ca..e6cafaef 100644 --- a/cmd/skopeo/copy.go +++ b/cmd/skopeo/copy.go @@ -17,6 +17,7 @@ import ( "github.com/containers/image/v5/transports/alltransports" encconfig "github.com/containers/ocicrypt/config" enchelpers "github.com/containers/ocicrypt/helpers" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -260,6 +261,15 @@ func (opts *copyOptions) run(args []string, stdout io.Writer) (retErr error) { } } + if destRef.Transport().Name() != "dir" { + if opts.destImage.dirForceCompression { + logrus.Warn("--dest-compress can only be used if the destination transport is 'dir'") + } + if opts.destImage.dirForceDecompression { + logrus.Warn("--dest-decompress can only be used if the destination transport is 'dir'") + } + } + return retry.IfNecessary(ctx, func() error { manifestBytes, err := copy.Image(ctx, policyContext, destRef, srcRef, ©.Options{ RemoveSignatures: opts.removeSignatures, diff --git a/systemtest/020-copy.bats b/systemtest/020-copy.bats index f1c2763f..7ab3e65f 100644 --- a/systemtest/020-copy.bats +++ b/systemtest/020-copy.bats @@ -50,7 +50,7 @@ function setup() { local dir=$TESTDIR/dir - run_skopeo copy --dest-compress --dest-compress-format=zstd $remote_image oci:$dir:latest + run_skopeo copy --dest-compress-format=zstd $remote_image oci:$dir:latest # zstd magic number local magic=$(printf "\x28\xb5\x2f\xfd")