Commit Graph

8 Commits

Author SHA1 Message Date
Valentin Rothberg 607e1273f1 libimage: Inspect: add InspectOptions
Add an InspectOptions struct for inspecting images.  This is a breaking
change but I think it's worth it since a considerable amount of CPU time
is spent in computing the image's parent (i.e., computing the layer is
costly) while this data is oftentimes not needed.

This cuts off 10ms of container-creation time in Podman.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-10-08 13:45:54 +02:00
Valentin Rothberg 724195c712 libimage: prune: allow for removing external containers
Support pruning images in use by external containers (e.g., build
containers).  Requires extending the containers filter, adding a
callback to libpod and a new options for image removal.

Tests will be added to Podman.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-27 13:47:50 +02:00
Valentin Rothberg 6dcfb65360 (*libimage.Image).HasDifferentDigest: add authentication
Allow for passing down credentials when comparing a local image with a
remote one.  The linked BZ relates to a regression in `podman auto-update`
but while reading the code I noticed it's also impacting pull policies.

BZ: bugzilla.redhat.com/show_bug.cgi?id=2000943
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-20 10:44:12 +02:00
Valentin Rothberg da6b1977dd 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>
2021-08-17 11:11:07 +02:00
Daniel J Walsh 241d1616a1 Add codespell fixes
[NO TESTS NEEDED] Just fixing spelling.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-08-11 16:43:59 -04:00
Valentin Rothberg 2a36074db6 libimage: {un}tag: reject digests
Make sure that tag and untag reject digested input.  Also add unit tests
for both to make sure we're not regressing in the future.

Fixes: containers/common#710
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-05 19:04:08 +02:00
Valentin Rothberg e983ccadc6 refine dangling filters
As discussed in github.com/containers/podman/issues/10832 the definition
of a "dangling" image in Podman has historically been incorrect.  While
the Docker docs describe a dangling image as an image without a tag, and
Podman implemented the filters as such, Docker actually implemented the
filters for images without a tag and without children.

Refine the dangling filters and hence `IsDangling()` to only return true
if an image is untagged and has no children.

Also correct the comments of `IsIntermediate()`.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-07-20 10:50:46 +02:00
Valentin Rothberg 04d1881aec libimage: add more image tests
Add unit tests for exercising all kinds of function of an `Image`
object.

Also remove an unused, redundant (and incomplete) `MountPoint` function.
`Mountpoint` is used by Podman instead.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-21 09:55:05 +02:00