Commit Graph

13 Commits

Author SHA1 Message Date
Paul Holzinger 40adf482cb fix issues reported by usetesting
In particular rework the tmpdir test to use two seperate runs so we can
correctl use t.Setenv() so it cleans up at the right moment.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-02-14 11:50:50 +01:00
Paul Holzinger 79e7aadc50 libimage tests: try to avoid docker.io images
These images can and will change at any time and thus can break our CI
without any external changes which is very bad. The TestPush test is
failing because it expects two not one image as it converts from docker
to oci on push. However the upstream docker.io/library/alpine was
switched to an oci image thus the test started failing as the local
storage now has the same id and just stores two different tags for the
same image.

Switch to our own controlled quay.io images where possible. This is
neither complete nor do I fully understand the tests here. I did a quick
search and replace and will see what works or not.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-11-19 18:50:55 +01:00
Jan Rodák 6b1528f145 Add ListImagesByNames and change the ListImages API
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-08-28 15:19:53 +02:00
Oleksandr Redko a1db72dfa0 Simplify tests by testing.TempDir instead of os.MkdirTemp
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-05 22:54:51 +02:00
Oleksandr Redko ba4c7c98bb chore: remove outdated build constraints
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-03 22:56:00 +02:00
Paul Holzinger 92c98a7323 libimage: add !remote tag
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>
2023-10-23 15:14:43 +02:00
Aditya R fe8cc2aba2 libimage/copier: wire ForceCompressionFormat for image copy
Implement https://github.com/containers/image/pull/2068 for
libimage/copier.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-08-11 14:22:27 +05:30
Valentin Rothberg 08a1459ebe layerTree: add images argument
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>
2023-03-28 11:05:29 +02:00
Valentin Rothberg 16611fbff1 libimage: ListImages: pre-compute dangling/parent
Checking whether an image is dangling and finding a parent image
requires building a layer tree.  Computing a layer tree is expensive, so
add options to `ListImages` to pre-compute the dangling and parent
information ahead of time;  that requires 1 layer tree instead of N.

Context: containers/podman/issues/17828
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-03-27 13:33:50 +02:00
Valentin Rothberg e17483b871 bump to golangci-lint v1.50.0
Used `go fmt` rules to migrate away from deprecated functions, for
instance `gofmt -w -s -r 'ioutil.TempDir(a, b) -> os.MkdirTemp(a, b)'`

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-17 15:03:07 +02:00
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 724e7c92b5 libimage: push: ignore image platform
When pushing an image, make sure to ignore the platform of the image to
push exactly what the user wishes to.  Add a test to make sure we're not
regressing in the future.

To preserve previous behaviour with respect to attempting to push a
manifest list, move the platform check below resolving to a manifest
list.

Fixes: #containers/podman/issues/10344
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-17 10:28:10 +02:00
Valentin Rothberg 4b08220b63 libimage: add push tests
Add tests for exercising pushing images to various transports and
attempt to pull from the destinations.

Fix an error determining the storage reference and image name when
pushing to containers-storage.

Fix a bug in `RemoveImages`: leaving `names` empty and specifying no
filters should remove *all* images.

Please note that the tests are currently not exercising pushing to a
registry.  That requires a local registry but since CI is currently
running inside a container, we cannot do much just yet.  Once CI runs
in another environment, I will go back and extend the tests.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-11 13:01:04 +02:00