Commit Graph

11 Commits

Author SHA1 Message Date
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
Nalin Dahyabhai 3bcb56c0be libimage: add compat interfaces for the new platform subpackage
Add compatibility interfaces for items which have been moved from the
main libimage package to its new platform subpackage.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-10-12 16:17:14 -04:00
Urvashi Mohnani dce8f8791d Move platform code to its own directory
Move the platform code into its own directory
under libimage so it can be used by farm build in
podman without causing the binary size to increase a lot.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-10-12 10:38:19 -04:00
Valentin Rothberg b836bfe388 libimage: format platform warning
Before:
`WARNING: image platform ({amd64 linux  [] }) does not match the expected platform ({arm64 linux  [] })`

After:
`WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)`

Fixes: containers/podman/issues/16392
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-03 09:45:11 +01: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
Aditya R 0f0e8ef3bc libimage.NormalizePlatform: normalize default variant as per specified arch
As of now NormalizePlatform ignores normalizing or setting default
variants for specific arch types thus producing empty variants in
results even when default variants were expected for such cases.

Example consider: `linux/armhf` -> `{os:linux, arch: arm, variant: v7}`

Signed-off-by: Aditya R <arajan@redhat.com>
2022-09-28 20:48:50 +05:30
Valentin Rothberg 5be7c13a41 libimage: platform: check if image is corrupted
When checking the platform of an image, take into account that it may be
corrupted.

Partially-fixes: containers/podman/issues/15853
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-09-20 13:00:20 +02:00
Valentin Rothberg fa2e6ee0bf libimage: normalize platforms correctly
Use containerd's platform package for platform checks. While the OCI
image spec requires the platform values to conform with GOOS and GOARCH
definitions of Go' runtime package, the values of uname are used by
convention.  Supporting these values silences annoying false-positive
warnings.

Fixes: #containers/podman/issues/14669
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-06-28 13:44:02 +02:00
Valentin Rothberg ba6a154f23 libimage: tweak platform checks
Do not check the platform of an image when it was looked up by it's ID.
In that case we must assume that the user/tool knows what they are
doing.

Further make the warnings configurable via a new `PlatformPolicy` field
in the `ImageLookupOptions`.  By default, the error will only be printed
on the debug logs.  User can opt-in to display the error on the warning
level.  Not all code paths should warn.  For instance, when inspecting
an image.  This way, consumers of libimage can opt-in.  The policy can
later on be extended to error out instead of logging.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-06-08 11:18:47 +02:00
Valentin Rothberg a06ba9fc05 libimage: image lookup: check platform
Check the platform when looking up images locally.  When the user
requested a custom platform and a local image doesn't match, the
image will be discarded.  Otherwise a warning will be emitted.

Also refactor the code to make it more maintainable in the future.

Fixes: containers/podman/issues/12682
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-31 16:59:11 +02:00