Commit Graph

5 Commits

Author SHA1 Message Date
Tonis Tiigi
af83e9af10 platforms: add support for matching amd64 variants
Correctly matches optional variants for amd64
arch. These should be used for standardized values
v1-v4 from https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels.

V1 remains the default and is cleared by default.
Pulling a higher variant will match the highest
available platform lower or equal to the provided one
when platformVector is used.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-18 20:13:37 -08:00
Akihiro Suda
e22ce0fa03
platforms: add subarchless version of Only()
`OnlyStrict()` returns a match comparer for a single platform.

Unlike `Only()`, `OnlyStrict()` does not match sub platforms.
So, "arm/vN" will not match "arm/vM" where M < N, and "amd64" will not also match "386".

`OnlyStrict()` matches non-canonical forms. So, "arm64" matches "arm/64/v8".

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-15 14:58:14 +09:00
Tianon Gravi
4073aaa7a9 Allow arm64 to fallback to arm (v8, v7, v6, v5)
This isn't supported by *all* arm64 chips, but it is common enough that I think it's worth an explicit fallback.  I think it will be more common for images to have arm64 support without arm support, but even if a user has an arm64 chip that does not support arm32, having it fail to run the arm32 image is an acceptable compromise (because it's non-trivial to detect arm32 support without running a binary, AFAIK).

Also, before this change the failure would've simply been "no such image" instead of "failed to run" so I think it's pretty reasonable to allow it to try the additional 32bit set of images just in case one of them actually does work (like it will on many popular chips like 64bit Raspberry Pis and AWS Graviton).

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2021-01-13 09:19:08 -08:00
Tianon Gravi
5fa5f15de5 Add amd64->386 fallback
Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2021-01-11 16:18:19 -08:00
Tianon Gravi
66a3f2cbc7 Add platforms.Only test
This adds a test for `platforms.Only` (previously untested, as far as I can tell).

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2020-12-23 14:54:16 -08:00