summaryrefslogtreecommitdiffstats
path: root/src/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipeline')
-rw-r--r--src/pipeline/mod.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs
index 1f57bed..9a53d80 100644
--- a/src/pipeline/mod.rs
+++ b/src/pipeline/mod.rs
@@ -180,13 +180,20 @@ impl Ctx {
/// 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))),
+ match &cfg.sandbox {
+ crate::config::Sandbox::Loopback => {
+ Ok(Arc::new(crate::sandbox::loopback::LoopbackBackend::new(cfg)))
+ }
+ crate::config::Sandbox::Remote { listen, token, .. } => Ok(Arc::new(
+ crate::sandbox::remote::RemoteBackend::bind(cfg, listen, token)?,
+ )),
+ // A valid kind that is not wired up yet is an error, never a
+ // fallthrough: a build configured for a Kata VM that silently ran
+ // as the hub's own user is the failure this enum was added to stop.
+ crate::config::Sandbox::AgentSandbox { .. } => Err(Error::invalid(concat!(
+ "sandbox kind \"agent-sandbox\" is not wired up yet; refusing to run this build ",
+ "on a backend it was not configured for",
+ ))),
}
}