From e35c3d757504ee075fe43a2a9b2a77295430ef4b Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 24 Nov 2017 14:14:26 -0500 Subject: [PATCH] Support tests in the builder --- ofborg/src/message/buildjob.rs | 6 ++++++ ofborg/src/tasks/build.rs | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ofborg/src/message/buildjob.rs b/ofborg/src/message/buildjob.rs index 2cefb6f..1fad4d9 100644 --- a/ofborg/src/message/buildjob.rs +++ b/ofborg/src/message/buildjob.rs @@ -27,6 +27,12 @@ impl Actions { ]; } + pub fn nasty_hack_linux_only(&mut self, _job: &BuildJob) -> worker::Actions { + return vec![ + worker::Action::Ack + ]; + } + pub fn merge_failed(&mut self, job: &BuildJob) -> worker::Actions { let msg = buildresult::BuildResult { repo: job.repo.clone(), diff --git a/ofborg/src/tasks/build.rs b/ofborg/src/tasks/build.rs index 954ce4f..77b8b55 100644 --- a/ofborg/src/tasks/build.rs +++ b/ofborg/src/tasks/build.rs @@ -10,6 +10,7 @@ use std::io::BufRead; use ofborg::checkout; use ofborg::message::buildjob; use ofborg::nix; +use ofborg::commentparser; use ofborg::worker; use amqp::protocol::basic::{Deliver,BasicProperties}; @@ -62,6 +63,17 @@ impl worker::SimpleWorker for BuildWorker { None => { String::from("origin/master") } }; + let buildfile = match job.subset { + Some(commentparser::Subset::NixOS) => "./nixos/default.nix", + _ => "./default.nix" + }; + + if buildfile == "./nixos/default.nix" && self.system != "x86_64-linux" { + // NixOS jobs get routed to all builders, even though darwin + // cannot build them. + return self.actions().nasty_hack_linux_only(&job); + } + let refpath = co.checkout_origin_ref(target_branch.as_ref()).unwrap(); co.fetch_pr(job.pr.number).unwrap(); @@ -81,7 +93,7 @@ impl worker::SimpleWorker for BuildWorker { let success: bool; let reader: BufReader; match self.nix.safely_build_attrs(refpath.as_ref(), - "./default.nix", + buildfile, job.attrs.clone()) { Ok(r) => { success = true;