summaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 11:49:50 +0000
committeraur-build <aur-build@localhost>2026-11-19 11:49:50 +0000
commit2eb4500f089154b982f7c5dbbc7f1efbfd702ed5 (patch)
tree6af449ea55d1dba0d3b8d685cf591ebec8d77eac /src/bin
parent3374ffd34921e1de414e8b07f69753113f5ba5f9 (diff)
downloadaur-build-2eb4500f089154b982f7c5dbbc7f1efbfd702ed5.tar.gz
aur-build-2eb4500f089154b982f7c5dbbc7f1efbfd702ed5.zip
sandbox: kata backend — ad-hoc TTL sandboxes over the agent protocol
The kata lease path is composition, not a new protocol: acquire mints a rendezvous nonce, asks a Provisioner for a sandbox pointed at this hub, and leases only the dial-in whose hello carries that nonce back. A box that never dials in is a TTL expiry — the same vocabulary every other failure here speaks (I5) — and a stray box that greets with a nonce nobody ordered is dropped unread, never leased. Two payload shapes are constructed as pure, unit-tested functions because both are real targets: an agent-sandbox-style Kubernetes CR (runtimeClass kata, activeDeadlineSeconds so the orchestrator enforces the TTL even if the hub dies) and a nerdctl/containerd argv for hosts without a cluster. The K8s provisioner is real ureq code exercised only by the gated live tier, which skips with a printed note wherever /dev/kvm or AUR_KATA_API is absent — the recorded-skip convention, not a silent pass. The rendezvous and TTL logic runs for real on any machine via LocalAgentProvisioner: a real sandbox-agent process, real frames, real nonce matching, no VM. That is the same honesty as the loopback backend — the interface is under test, not a mock of it.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/sandbox-agent.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/sandbox-agent.rs b/src/bin/sandbox-agent.rs
index 1c2a8d8..4e959a9 100644
--- a/src/bin/sandbox-agent.rs
+++ b/src/bin/sandbox-agent.rs
@@ -11,6 +11,7 @@ fn main() {
let mut token = None;
let mut profile = Some("extra-x86_64".to_string());
let mut ttl = 90u64;
+ let mut agent_id = None;
let args: Vec<String> = std::env::args().skip(1).collect();
let mut i = 0;
while i < args.len() {
@@ -22,6 +23,7 @@ fn main() {
"--hub" => take(&mut i).map(|v| hub = Some(v)),
"--token" => take(&mut i).map(|v| token = Some(v)),
"--profile" => take(&mut i).map(|v| profile = Some(v)),
+ "--agent-id" => take(&mut i).map(|v| agent_id = Some(v)),
"--ttl" => take(&mut i).and_then(|v| v.parse::<u64>().map(|t| ttl = t).map_err(|_| "bad ttl".to_string())),
other => Err(format!("unknown argument {other}")),
};
@@ -44,6 +46,7 @@ fn main() {
token,
profile: profile.unwrap(),
ttl: Duration::from_secs(ttl),
+ agent_id,
};
if let Err(e) = aur_build::sandbox::agent::serve(&opts) {
eprintln!("sandbox-agent: {e}");