libimage: relax untag by digest checks
Relax the digest checks when untagging. Podman CI relies on `rmi foo@digest` to actually work even when only untagging the image. The behavior is wrong since the digest is not getting removed from the image at all BUT there's currently no way in our stack to do that. To tackle the problem at the source, we need a way in c/storage to alter the digests of an image, similar to `SetNames()` for altering the names/tags of an image. Once that's done, Podman can behave as Docker does and allow for altering the digests. For now, to unblock ongoing work, let's just relax the checks and leave a FIXME note. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
parent
100405d48b
commit
da6b1977dd
|
|
@ -499,9 +499,15 @@ func (i *Image) Untag(name string) error {
|
|||
return errors.Wrapf(err, "error normalizing name %q", name)
|
||||
}
|
||||
|
||||
if _, isDigested := ref.(reference.Digested); isDigested {
|
||||
return errors.Wrap(errUntagDigest, name)
|
||||
}
|
||||
// FIXME: this is breaking Podman CI but must be re-enabled once
|
||||
// c/storage supports alterting the digests of an image. Then,
|
||||
// Podman will do the right thing.
|
||||
//
|
||||
// !!! Also make sure to re-enable the tests !!!
|
||||
//
|
||||
// if _, isDigested := ref.(reference.Digested); isDigested {
|
||||
// return errors.Wrap(errUntagDigest, name)
|
||||
// }
|
||||
|
||||
name = ref.String()
|
||||
|
||||
|
|
|
|||
|
|
@ -248,8 +248,8 @@ func TestUntag(t *testing.T) {
|
|||
{"quay.io/image/foo", "quay.io/image/foo", false},
|
||||
{"foo", "doNotExist", true},
|
||||
{"foo", digest, true},
|
||||
{"foo", "foo@" + digest, true},
|
||||
{"foo", "localhost/foo@" + digest, true},
|
||||
// {"foo", "foo@" + digest, false},
|
||||
// {"foo", "localhost/foo@" + digest, false},
|
||||
} {
|
||||
err := image.Tag(test.tag)
|
||||
require.NoError(t, err, "tag should have succeeded: %v", test)
|
||||
|
|
@ -265,6 +265,6 @@ func TestUntag(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for specific error.
|
||||
err = image.Untag("foo@" + digest)
|
||||
err = image.Untag(digest)
|
||||
require.True(t, errors.Cause(err) == errUntagDigest, "check for specific digest error")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue