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>
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>
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>
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>
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>
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>
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>
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>
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>
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>