Set the build platform on ARM64 hosts - #7
Conversation
0xbbuddha
left a comment
There was a problem hiding this comment.
Perfect, this closes #6 exactly as scoped. Reusing get_image_platform(), keeping the import local, and the ARM validation with the resulting image reporting linux/amd64 are all what I was hoping for. CI is green, I ran the suite locally at 115, and I printed the generated argv to confirm the flag placement, all options land before the build context. Merging.
One nit, worth fixing at some point rather than now: you import from nihil.utils import get_image_platform, while manager.py uses from nihil.utils.platform_info import .... Both work, but it leaves the test suite with two different patch targets, nihil.utils.get_image_platform here and nihil.utils.platform_info.get_image_platform in test_nihilManager.py. If someone later writes a _cmd_build test patching the platform_info path, the patch silently won't apply, the test will run against the real host arch, and it'll pass green on our amd64 CI while testing nothing. Not worth another round trip on this PR, I'll align both on the submodule path in a follow-up commit.
Also noting for the record that your validation used a minimal archlinux:latest tree rather than the full image. That's the right call for verifying the flag, and a complete ARM build of the real image is going to be slow enough under emulation that I wouldn't ask anyone to sit through one. If you ever do run it end to end, we'd genuinely like to know how it goes.
Thanks for your contribution.
Summary
Pass the Nihil image platform to
docker buildon ARM64 hosts.The existing pull and container creation paths select
linux/amd64for the currently amd64-only Nihil images. The local build path did not apply the same selection, sonihil buildcould resolve base images for the ARM64 host architecture instead.Changes
get_image_platform()in_cmd_build().--platform linux/amd64when building onarm64oraarch64hosts.nihil.utils/ manager import cycle.full,blueteam, andtestbuild variants.Apple Silicon validation
Validated on macOS ARM64 with OrbStack using
nihil buildand a minimal source tree based onarchlinux:latest:Resulting image and runtime architectures:
Tests
Additional checks:
uv pip checkgit diff --checkpython -m compileall -q nihil testsnihil buildsmoke test againstarchlinux:latestCloses #6.