Commit Graph

13 Commits

Author SHA1 Message Date
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
Jan Rodák e5b4d28057 Create test for ListImages methode
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-08-28 11:48:28 +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
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
Kir Kolyshkin 27bf522212 .golanci-lint: enable gofumpt
gofumpt is more opinionated version of gofmt. One can use it from their
$EDITOR, or IDE, or gopls to better format the source code.

Previously, commit b951b72412 already formatted all the code with
gofumpt, but since then a couple of things crept in.

Fix these (with gofumpt v0.3.1) and enable the gofumpt linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-05-16 20:01:08 -07:00
Daniel J Walsh aec9f8f79b libimage should be using containers.conf for tmpdir
if image_copy_tmp_dir is set in containers.conf it needs to be used in
the systemcontext for BigFilesTemporaryDir value.

Fixes: https://github.com/containers/podman/issues/14091

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-04 16:55:25 -04:00
Kir Kolyshkin 4393468343 *_test.go: fix or suppress errcheck warnings
Where we can check the error, do it. Where we can not, ignore it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-04-09 15:18:22 -07:00
Valentin Rothberg e369277804 libimage: refine pull-policy enforcement for custom platforms
When pulling down an image with a user-specified custom platform, we
try to make sure that user gets what they are asking for.  An inherent
issue with multi-arch images is that there are many images in the wild
which do not get the platform right (see containers/podman/issues/10682).
That means we need to pessimistically assume that the local image is
wrong and pull the "correct" one down from the registry; in the worst case
that is redundant work but we have a guarantee of correctness.

Motivated by containers/podman/issues/12707 I had another look at the
code and found some space for optimizations.  Previously, we enforced
the pull policy to "always" but that may be too aggressive since we may
be running in an airgapped environment and the local image is correct.

With this change, we enforce the pull policy to "newer" which makes
errors non-fatal in case a local image has been found; this seems like a
good middleground between making sure we are serving the "correct" image
and user friendliness.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-10 16:27:10 +01:00
Valentin Rothberg fa1504c98a libimage: `(*Runtime).SystemContext()`
Add a method to the libimage runtime to access (a copy of) its
types.SystemContext.  That can be helpful for callers which may need to
access the system context.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-24 10:41:25 +02:00
Daniel J Walsh e2264b5823 Set BigFilesTemporaryDir to GetEnv(TMPDIR) if set or /var/tmp
Currently if the caller does not specify the BigFilesTemporaryDir,
Podman and Buildah users expect this to default TMPDIR environment
variable or /var/tmp if not set.

Moving to libimage caused a regression in this functionality.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-16 10:53:59 -04:00
Valentin Rothberg 3b721f41df libimage: add unit tests
This adds tests pulling and a framwork that can be used to add more
tests in the future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-06 15:41:33 +02:00