From dae0d5343cd740ab250b35e1ca44f18fdd8d15e1 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Fri, 26 Jan 2024 14:49:49 -0800 Subject: [PATCH 1/3] Support multiple evaluators on a single machine --- ofborg/src/bin/mass-rebuilder.rs | 3 ++- ofborg/src/config.rs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ofborg/src/bin/mass-rebuilder.rs b/ofborg/src/bin/mass-rebuilder.rs index 5d118c3e..d35775ba 100644 --- a/ofborg/src/bin/mass-rebuilder.rs +++ b/ofborg/src/bin/mass-rebuilder.rs @@ -35,7 +35,8 @@ fn main() -> Result<(), Box> { let conn = easylapin::from_config(&cfg.rabbitmq)?; let mut chan = task::block_on(conn.create_channel())?; - let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root)); + let root = Path::new(&cfg.checkout.root); + let cloner = checkout::cached_cloner(&root.join(cfg.runner.instance.to_string())); let nix = cfg.nix(); let events = stats::RabbitMq::from_lapin(&cfg.whoami(), task::block_on(conn.create_channel())?); diff --git a/ofborg/src/config.rs b/ofborg/src/config.rs index c095cfef..dba6806c 100644 --- a/ofborg/src/config.rs +++ b/ofborg/src/config.rs @@ -64,8 +64,14 @@ pub struct LogStorage { pub path: String, } +const fn default_instance() -> u8 { + 1 +} + #[derive(Serialize, Deserialize, Debug)] pub struct RunnerConfig { + #[serde(default = "default_instance")] + pub instance: u8, pub identity: String, pub repos: Option>, #[serde(default = "Default::default")] From f9c1379f2fc886adbdefadf0ad2aa0b149dfd27b Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Tue, 16 Jan 2024 14:22:21 -0800 Subject: [PATCH 2/3] clone: also cleanup checkout with `git gc` --- ofborg/src/clone.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ofborg/src/clone.rs b/ofborg/src/clone.rs index 5e2fa469..b054f0fb 100644 --- a/ofborg/src/clone.rs +++ b/ofborg/src/clone.rs @@ -147,6 +147,13 @@ pub trait GitClonable { .stdout(Stdio::null()) .status()?; + debug!("git gc"); + Command::new("git") + .arg("gc") + .current_dir(self.clone_to()) + .stdout(Stdio::null()) + .status()?; + lock.unlock(); Ok(()) From 80ef583ff6816d100d0cbc6d6507e6713840cb34 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Sat, 20 Jan 2024 17:24:59 -0800 Subject: [PATCH 3/3] build: send Ack if HEAD failed to fetch Nothing we can do. --- ofborg/src/tasks/build.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ofborg/src/tasks/build.rs b/ofborg/src/tasks/build.rs index 60569a11..6284124e 100644 --- a/ofborg/src/tasks/build.rs +++ b/ofborg/src/tasks/build.rs @@ -92,6 +92,10 @@ impl<'a, 'b> JobActions<'a, 'b> { self.snippet_log.clone().into() } + pub fn pr_head_missing(&mut self) { + self.tell(worker::Action::Ack); + } + pub fn commit_missing(&mut self) { self.tell(worker::Action::Ack); } @@ -311,7 +315,12 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker { }; let refpath = co.checkout_origin_ref(target_branch.as_ref()).unwrap(); - co.fetch_pr(job.pr.number).unwrap(); + + if co.fetch_pr(job.pr.number).is_err() { + info!("Failed to fetch {}", job.pr.number); + actions.pr_head_missing(); + return; + } if !co.commit_exists(job.pr.head_sha.as_ref()) { info!("Commit {} doesn't exist", job.pr.head_sha);