diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 11:36:36 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 11:36:36 +0000 |
| commit | 3374ffd34921e1de414e8b07f69753113f5ba5f9 (patch) | |
| tree | ea60c89b4e80d9c690761eb6399f2ddcfad56daa /src/pipeline/mod.rs | |
| parent | bc8f069d18c5de3dee04ae303227a255248efc1e (diff) | |
| download | aur-build-3374ffd34921e1de414e8b07f69753113f5ba5f9.tar.gz aur-build-3374ffd34921e1de414e8b07f69753113f5ba5f9.zip | |
sandbox: ephemeral agent, wire protocol, and the hub's remote backend
The seam from the previous commits only had one body. This adds the
other one: a sandbox-agent binary that dials the hub (outbound
rendezvous — the hub never needs a route into an untrusted box), serves
Run/Put/Get frames over length-prefixed JSON, streams the child's
stdout/stderr as they fill, and dies — taking its child with it — when
the connection drops or its TTL expires. The TTL watchdog is the
backstop under every leak: hub crash, partition, a forgotten destroy.
Hub side, RemoteBackend implements the same SandboxBackend: acquire
waits for a dial-in and verifies the shared token and profile before a
lease exists; a vanished sandbox fails the step, which is already the
shape of an expired lease (I5), so the remote path adds no new failure
vocabulary. Run frames carry the hub's child environment, so the §16a
shim protocol reaches remote children exactly as local ones — which is
what makes the end-to-end test honest: a real build, real frames, real
log streaming into the SSE-tailed file, no root and no container.
Workspace sync over the wire is deliberately not here: Run carries a
hub-side cwd, honest for loopback-shaped deployments and this test
tier, and the module says so rather than pretending.
Diffstat (limited to 'src/pipeline/mod.rs')
| -rw-r--r-- | src/pipeline/mod.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs index 5e0a823..1f57bed 100644 --- a/src/pipeline/mod.rs +++ b/src/pipeline/mod.rs @@ -171,10 +171,25 @@ impl Ctx { log: cfg.build_log_path(build_id), profile, attempt, - backend: Arc::new(crate::sandbox::loopback::LoopbackBackend::new(cfg)), + backend: Self::backend_for(cfg)?, }) } + /// Which backend a build runs on is configuration, not code: the step + /// machine cannot tell loopback from remote, which is the seam's whole + /// point. `remote` binds the agent listener for the lifetime of this + /// run's context. + fn backend_for(cfg: &Config) -> Result<Arc<dyn SandboxBackend>> { + match cfg.sandbox_backend.as_str() { + "remote" => Ok(Arc::new(crate::sandbox::remote::RemoteBackend::bind( + cfg, + &cfg.agent_listen, + &cfg.agent_token, + )?)), + _ => Ok(Arc::new(crate::sandbox::loopback::LoopbackBackend::new(cfg))), + } + } + /// Lease a sandbox for this build's profile. Today every step acquires and /// releases around itself; a remote backend will hold one sandbox across /// the sandbox-bearing steps of a build, and steps stay idempotent either |
