diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-09-20 12:50:16 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-09-22 16:21:56 -0400 |
commit | 7bfe9ca3daec52cc5599688db8db121060b17623 (patch) | |
tree | bb6dbfc6c0db964b608ef4fdecb0a76c5f4d0f13 | |
parent | 7e69211707faee0a2f12b4391bbb12868d1f4a09 (diff) | |
download | podman-7bfe9ca3daec52cc5599688db8db121060b17623.tar.gz podman-7bfe9ca3daec52cc5599688db8db121060b17623.tar.bz2 podman-7bfe9ca3daec52cc5599688db8db121060b17623.zip |
remote untag: support digests
Fix a bug when remotely untagging an image via tag@digest.
The digest has been lost in the remote client and hence led
to a wrong behaviour on the server.
Fixes: #11557
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
-rw-r--r-- | pkg/domain/infra/tunnel/images.go | 3 | ||||
-rw-r--r-- | test/system/001-basic.bats | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go index db4e14aba..9a746d68c 100644 --- a/pkg/domain/infra/tunnel/images.go +++ b/pkg/domain/infra/tunnel/images.go @@ -165,6 +165,9 @@ func (ir *ImageEngine) Untag(ctx context.Context, nameOrID string, tags []string if t, ok := ref.(reference.Tagged); ok { tag = t.Tag() } + if t, ok := ref.(reference.Digested); ok { + tag += "@" + t.Digest().String() + } if r, ok := ref.(reference.Named); ok { repo = r.Name() } diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats index 963c89281..888c075b8 100644 --- a/test/system/001-basic.bats +++ b/test/system/001-basic.bats @@ -57,6 +57,9 @@ function setup() { # Now untag the digest reference again. run_podman untag $IMAGE $IMAGE@$digest + + # Make sure the original image is still present (#11557). + run_podman image exists $IMAGE } # PR #7212: allow --remote anywhere before subcommand, not just as 1st flag |