summaryrefslogtreecommitdiffstats
path: root/src/pipeline/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipeline/mod.rs')
-rw-r--r--src/pipeline/mod.rs17
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