action: implement multi-arch buildkitd with insecure mode#88
Closed
adityamaru wants to merge 2 commits intomainfrom
Closed
action: implement multi-arch buildkitd with insecure mode#88adityamaru wants to merge 2 commits intomainfrom
adityamaru wants to merge 2 commits intomainfrom
Conversation
Add multiarch.ts module that handles: - Multi-arch detection from platforms input - Follower sandbox spawning via POST /api/sandbox - Ephemeral ED25519 SSH keypair generation for inter-VM comms - Buildkitd startup on follower via SSH exec - Port exposure via tunnel manager (localhost:8377/expose-port) Integrate into main.ts: - Detect multi-arch need from platforms input - Spawn follower sandbox on opposite arch - Create multi-node buildx builder (host + follower) - QEMU fallback if follower setup fails - Cleanup follower sandbox in post-action phase Update state-helper.ts: - Add follower VM ID, arch, and buildkitd addr state management Depends on BLACKSMITH_SANDBOX_TOKEN being available in VM env. Ref: BLA-790 Co-Authored-By: maru@blacksmith.sh <adityamaru@gmail.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: maru@blacksmith.sh <adityamaru@gmail.com>
5 tasks
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
Adds native multi-arch Docker build support by spawning a follower sandbox VM on the opposite architecture, starting buildkitd on it, and creating a multi-node buildx builder. When
platformsincludes bothlinux/amd64andlinux/arm64, the action will:/tmp)POST /api/sandboxusingBLACKSMITH_SANDBOX_TOKEN:1234localhost:8377/expose-port)DELETE /api/sandbox/{vm_id}If follower setup fails, a warning is logged and the build falls back (though QEMU wiring is not implemented yet — builds would just fail for the non-native platform).
This is intentionally insecure — buildkitd listens without auth. A follow-up PR will add mTLS.
Depends on fa#3557 and web#5999 for
BLACKSMITH_SANDBOX_TOKENto be available in VMs.Ref: BLA-790
Review & Testing Checklist for Human
/(.*)\s*$/to/(.*)\ s*$/in multiple places (lines ~720, ~745, ~792 in main.ts).\ sis NOT\s— this breaks the stderr error extraction regex. Applies to both new code AND the pre-existing "set as default builder" error handler. This needs to be fixed before merge.POST /api/sandboxaccepts{ arch, ssh_public_key, vcpu, teardown_minutes, labels }and returns{ vm_id }. VerifyGET /api/sandbox/{vm_id}returns{ ssh_connection_string }. VerifyDELETE /api/sandbox/{vm_id}exists. These are assumptions based on the numbersmith SDK POC.teardown_minutes: 0semantics: Confirm that0means "no auto-teardown" rather than "teardown immediately" in the backend.exposeFollowerBuildkitddoesJSON.parse()on raw SSH stdout with no guard — non-JSON output (e.g. SSH banner, error message) will throw a confusing error.platforms: linux/amd64,linux/arm64using this branch of setup-docker-builder. Verify follower sandbox is created, buildkitd starts, tunnel exposes the port, buildx cluster forms, a multi-arch image is built, and the follower is cleaned up afterwards. Also verify a single-arch build (noplatformsor single platform) still works without changes.Notes
multiarch.ts— the module does SSH/HTTP against live infrastructure so it's inherently integration-test territory.vcpu: 2for the follower is hardcoded. May want to make this configurable or match the leader's spec.maybeShutdownBuildkitd,logBuildkitdCrashLogs).Link to Devin session: https://app.devin.ai/sessions/4bed582243a84e75be318f407802a563
Requested by: @adityamaru
Codesmith can help with this PR — just tag
@codesmithor enable auto-fix issues. Settings