Repository navigation
[oryx] - Publish Oryx for the host architecture (arm64 support) - #1759
Fairuzan Roslan (fairuzan) wants to merge 3 commits into
Conversation
The install script always ran `dotnet publish -r linux-x64`, so on arm64
hosts the feature installed an x86-64 GenerateBuildScript binary that
fails to execute ("exec format error", or a Rosetta loader error under
Docker Desktop on Apple silicon).
Map the dpkg architecture to the matching .NET runtime identifier
(amd64 -> linux-x64, arm64 -> linux-arm64) and fail early on anything
else. Add a test that checks the ELF machine type of the published
binary, since emulation can otherwise hide a mismatch.
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the architecture-aware Oryx binary publishing changes.
No open issues 🎉
What changed in this PR
Updates the Oryx feature to publish native binaries for amd64 and arm64, addressing the CLI architecture mismatch that blocks arm64 universal images. Downloaded SDK architecture support remains out of scope.
Changes:
- Selects the .NET runtime identifier from the system architecture for both publish commands and rejects unsupported architectures.
- Adds an ELF architecture check to detect mismatches even when emulation allows execution.
- Bumps the feature version to 2.0.3.
| File | Description |
|---|---|
test/oryx/test.sh |
Checks that the Oryx binary’s ELF architecture matches the host. |
src/oryx/install.sh |
Publishes both Oryx applications for amd64 or arm64. |
src/oryx/devcontainer-feature.json |
Bumps the feature version from 2.0.2 to 2.0.3. |
Review effort: Balanced
Kaniska (v-Kaniska244)
left a comment
There was a problem hiding this comment.
Hi Fairuzan Roslan (@fairuzan)
Thank you for the contribution. Would you kindly modify this arm64 test workflow as well to include trigger for oryx feature, now that oryx installation should be supported on arm64 systems with this change. Currently that workflow is only triggered for powershell and docker-in-docker features changes.
Add oryx to the paths and change filters of test-pr-arm64.yaml so that changes to the feature are tested on arm64 runners. Mirror the existing amd64 matrix exclusions for oryx (ubuntu:jammy and mcr.microsoft.com/devcontainers/base:ubuntu), which the feature does not support.
|
Thanks Kaniska (@v-Kaniska244). I've added oryx to I also excluded oryx from Before pushing I ran the same commands locally on an arm64 machine (Apple silicon). The autogenerated test passes on |
Kaniska (v-Kaniska244)
left a comment
There was a problem hiding this comment.
To be further reviewed by maintainers.
Replace the raw ELF header read with `file`, which reports the binary's architecture in readable form. `file` is not present on the base images used in CI, so install it at the start of the test (with sudo when the test runs as a non-root user), following the check_packages pattern used by other feature tests.
Problem
src/oryx/install.shalways publishes Oryx with-r linux-x64, so on arm64 hosts the feature installs successfully but leaves an x86-64 binary that cannot run:(On native arm64 Linux this shows up as
exec format errorinstead of the Rosetta error from Docker Desktop on Apple silicon.)This is currently one of the blockers for an arm64 build of
mcr.microsoft.com/devcontainers/universal. When I builtsrc/universalnatively on arm64, all 10 Oryx-related checks in itstest-project/test.shfailed for this reason. See also devcontainers/images#1604.Changes
dpkg --print-architectureto the matching .NET runtime identifier (amd64→linux-x64,arm64→linux-arm64) and use it for bothdotnet publishcalls. Unsupported architectures fail early with the same(!) Architecture ... unsupportedmessage the hugo/php/ruby features use.oryx-binary-matches-architecturetest that reads the ELFe_machinefield ofGenerateBuildScriptand compares it touname -m.oryx --versionalone can miss a mismatch when QEMU or Rosetta emulation is available.On amd64 the published runtime identifier is still
linux-x64, so the build output there doesn't change.Testing
devcontainer features test --features oryx --project-folder .run natively on arm64 (Apple silicon, Docker Desktop 29.9.2,aarch64Linux VM):including:
After the change:
I also swapped an arm64 build of Oryx into the
universalimage.oryx --version,oryx buildof the Python sample, andoryx prepall work there.I did not test on amd64 locally. CI on this PR covers that path.
Known limitation (out of scope)
This fixes the Oryx CLI itself. Separately, the SDKs that
oryx prep/ dynamic install download fromhttps://oryx-cdn.microsoft.ioare x86-64 builds regardless of host architecture. On arm64 the downloaded/opt/nodejs/20.11.0/bin/nodeand/opt/php/8.1.30/bin/phpare x86-64 and fail to execute. The existing*-installed-by-oryxchecks still pass because they only list/opt/<platform>and don't run the binaries. Fixing that needs arm64 SDK builds on the Oryx side (microsoft/Oryx), so it isn't part of this PR.