mirror of
https://github.com/containers/skopeo.git
synced 2025-04-27 11:01:18 +00:00
warn users about --dest-compress and --dest-decompress misuse
Signed-off-by: Erol Keskin <erolkeskin.dev@gmail.com>
This commit is contained in:
parent
06cf25fb53
commit
d3ff6e2635
@ -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,
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user