Evaluate all in a single ident-based dir

This commit is contained in:
Graham Christensen 2017-11-26 09:02:17 -05:00
parent 32a8206a67
commit e188462323
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 11 additions and 3 deletions

View file

@ -51,7 +51,12 @@ fn main() {
channel.basic_prefetch(1).unwrap(); channel.basic_prefetch(1).unwrap();
channel.basic_consume( channel.basic_consume(
worker::new(tasks::build::BuildWorker::new(cloner, nix, cfg.nix.system.clone())), worker::new(tasks::build::BuildWorker::new(
cloner,
nix,
cfg.nix.system.clone(),
cfg.runner.identity.clone()
)),
format!("build-inputs-{}", cfg.nix.system.clone()).as_ref(), format!("build-inputs-{}", cfg.nix.system.clone()).as_ref(),
format!("{}-builder", cfg.whoami()).as_ref(), format!("{}-builder", cfg.whoami()).as_ref(),
false, false,

View file

@ -20,14 +20,16 @@ pub struct BuildWorker {
cloner: checkout::CachedCloner, cloner: checkout::CachedCloner,
nix: nix::Nix, nix: nix::Nix,
system: String, system: String,
identity: String,
} }
impl BuildWorker { impl BuildWorker {
pub fn new(cloner: checkout::CachedCloner, nix: nix::Nix, system: String) -> BuildWorker { pub fn new(cloner: checkout::CachedCloner, nix: nix::Nix, system: String, identity: String) -> BuildWorker {
return BuildWorker{ return BuildWorker{
cloner: cloner, cloner: cloner,
nix: nix, nix: nix,
system: system, system: system,
identity: identity,
}; };
} }
@ -54,9 +56,10 @@ impl worker::SimpleWorker for BuildWorker {
} }
fn consumer(&self, job: &buildjob::BuildJob) -> worker::Actions { fn consumer(&self, job: &buildjob::BuildJob) -> worker::Actions {
info!("Working on {}", job.pr.number);
let project = self.cloner.project(job.repo.full_name.clone(), job.repo.clone_url.clone()); let project = self.cloner.project(job.repo.full_name.clone(), job.repo.clone_url.clone());
let co = project.clone_for("builder".to_string(), let co = project.clone_for("builder".to_string(),
job.pr.number.to_string()).unwrap(); self.identity.clone()).unwrap();
let target_branch = match job.pr.target_branch.clone() { let target_branch = match job.pr.target_branch.clone() {
Some(x) => { x } Some(x) => { x }