fix(cni): select embedded CNI plugins by arch (arm64 macOS dispatch)#119
Merged
Conversation
On Apple Silicon, ephemerd boots an arm64 Linux VM to run Linux container jobs. The macOS build cross-compiles ephemerd-linux for arm64 and downloads the arm64 CNI plugins, but the amd64 tarball also lingers in pkg/cni/embed/ (CI cache / Dockerfile). `//go:embed all:embed` bundles both, and findTarball() returned the first entry — amd64. Every container's CNI setup then failed inside the arm64 VM with: plugin type="loopback" ... exec format error so no Linux job could run on a Mac runner. Select the archive by runtime.GOARCH (the compiled arch of the in-VM ephemerd-linux) instead of grabbing whichever tarball sorts first. The runners already stash non-matching arches for this reason; CNI now does the equivalent at extract time. Pure selection logic lives in select.go with a table test; a clear error lists what's embedded when no arch matches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second darwin/arm64 asset-selection bug (sibling of #118). Caught live: no Linux job can run on an Apple Silicon Mac runner — every one dies at container network setup with:
Root cause: on macOS, ephemerd runs Linux container jobs inside an arm64 Linux VM. The macOS build cross-compiles ephemerd-linux for arm64 and downloads the arm64 CNI plugins — but the amd64 tarball also lingers in
pkg/cni/embed/(CI cache / runner Dockerfile).//go:embed all:embedbundles both, andfindTarball()returned the first entry, which sorts to amd64. So the arm64 VM got amd64 CNI binaries → exec format error → all Linux jobs fail.The runner assets already stash non-matching arches to avoid exactly this; CNI didn't.
Change
findTarball()now selectscni-plugins-linux-<GOARCH>-*.tgzby the compiled arch of the in-VM ephemerd-linux (arm64 on Apple Silicon, amd64 on Linux/Windows-VM). Pure selection logic extracted toselect.gowith a table test; a clear error lists what's embedded when no arch matches.Test plan
TestSelectCNITarball— arm64 picks arm64 when both are embedded (the actual bug), amd64 picks amd64, gitkeep skipped, no-match/empty errorNote
Discovered while bringing up the first mayfly-managed Mac mini runner. The mini's Linux dispatch is currently disabled (daemon booted out) to stop it claiming+failing org Linux jobs; it comes back once this ships in a release.