Commit Graph

10 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
Nalin Dahyabhai 2f0cf99f30 Add a libimage.Runtime.LoadReference for loading images
Add a LoadReference() method, for when we already know what format the
local image should be treated as, and we don't have the patience for
Load()'s guessing at it.

Teach libimage.Runtime.copyFromDefault() about the docker transport.
It's already required at build-time because it's directly referenced
elsewhere in the same file.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-03-25 09:40:54 -04: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
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 4422f38959 libimage: load: close reader
Close the reader of an Docker archive to make sure that artifacts in
TMPDIR are removed.

Closes: github.com/containers/podman/issues/14287
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-19 17:08:48 +02:00
Valentin Rothberg c08c28e17c load: support buildkit archives
Archives generated with buildkit have some kind of "hybrid" layout which
is the same for OCI and Docker archives.  OCI ones ship with a
manifest.json but set the image's reference in the index.json but in a
custom annotation and not the one the OCI image spec wants.  Archives
in the Docker format set the reference in `RepoTags` of the
manifest.json.

To support these archives, simply look for the custom containerd
annotation *and* change the order back to give OCI archives precedence.

Fixes: containers/podman/issues/12560
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-10 13:24:05 +01:00
Valentin Rothberg da2875b837 libimage: force remove: only untag on multi tag image
When removing an image by name, do not remove the image and all its
tags, even if force is set.  Instead, just untag the specified name.

Note: adjust the load test to preserve the order in the untagged field.

Also vendor in the latest HEAD in containers/image to fix a bug revealed
in Podman CI.

Context: containers/podman/issues/10685
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-17 15:46:14 +02:00
Valentin Rothberg fea35ddf36 libimage: add load unit tests
Add unit tests for loading images.  This covers the most important
formats of docker-archive and oci-archive.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-10 13:59:35 +02:00