To prevent the podman remote client from using libimage which causes a
lot of bloat due the c/image and c/storage dependencies add the
`!remote` tag.
This will cause a hard compile time failure if the remote client ends up
pulling in libimage.
Fixes#1702
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Layer tree expectes to form a relation between child and parent
instances, however it expects an instance from manifest list which is
empty, following expectation is not possible and will always resuilt in
error.
Closes: https://github.com/containers/podman/issues/19860
[NO NEW TESTS NEEDED]
Image without layer cant be built in libimage, and `podman save`
automatically malforms such image so no such external image can be
loaded.
Signed-off-by: Aditya R <arajan@redhat.com>
Commit 3e9cdd9c53 took a first stab at making operating on the layer
tree more resilient by detecting unknown-image errors. Testing in
containers/podman/pull/18980 revealed that we also need to detect
unknown-layer and -size errors as well.
Move the errors checks into a convenience function and update the
relevant call sites to facilitate future changes. Export the
function since Podman needs the very same checks when operating
on images, for instance, when looking up image labels.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Make operating on the layer tree more resilient towards parallel image
removals by checking for unknown-image errors. This partially fixes
below linked BZ.
At the time of writing, I do not have a reliable easy (and short
running) reproducer. Hence, I suggest to merge this change without
tests and rely on either Podman CI (which doesn't have a reliable test
yet either) and the QE team (will be informed).
BZ: bugzilla.redhat.com/show_bug.cgi?id=2216700
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Computing the layer tree requires listing all images. Certain code
paths have all images at hand already, so let's optimize a bit to
avoid listing them redundantly.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
It turns out only counting the layers size is not sufficient for
`podman systemd df` as it excludes the size of the manifests, configs
and potentially attached meta data in the storage.
Instead, sum the image sizes but distract redundant layers. That indeed
gives the expected result and does not yield negative results for
reclaimable space.
Remove the unrelease LayersDiskUsage function again to avoid expensive
recalculation of the layer tree. We are still below 1.0, and I am
convinced the total image size belongs into DiskUsage.
NOTE: The DiskUsage function does not have test coverage in libimage.
This should be addressed at some point but in the interest of
time I leverage podman's system tests.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Handle images without physical layers when constructing the layer tree
and store them in a dedicated slice that can later on be consulted when
computing parent/child relations.
Such "empty" images can be built with, for instance, with the following
Dockerfile:
```
FROM scratch
ENV test1=test1
ENV test2=test2
```
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
The new `libimage` package is an attempt to consolidate the code for
managing container images and performing operations on them such as
pulling, pushing, saving, searching, local lookups, removing etc.
Over time, Buildah, CRI-O and Podman diverged with respect to managing
container images resulting in a high amount of code duplication
rendering the tools harder to maintain (e.g., bug fixes) and harder to
extend (e.g., adding new features) than necessary.
The desire to share all that code in a common library grew and this is
an attempt to address the it.
The changes as they are now pass Buildah CI [1]. Once merged into
Buildah, I expect follow up changes when migrating Podman over to
`libimage`.
Miscellaneous changes:
* Copy `podman/pkg/signal` to `pkg/signal`.
* Copy `buildah/manifests` to `image/manifests`. Note that the unit
tests require root privileges. Skip()'s are added when running
rootless. Currently excluded from linting.
* Copy `buildah/pkg/manifests` to `pkg/manifests`. Currently excluded
from linting.
* Copy `buildah/pkg/supplemented` to `pkg/supplemented`. Currently
excluded from linting.
[1] github.com/containers/buildah/pull/3148
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>