From 9c83a06ab18595539d4ac84021bc6a5ba863066c Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 21 Mar 2019 18:09:18 -0400 Subject: [PATCH] Rename mass-rebuilder things to evaluation --- ofborg/src/bin/mass-rebuilder.rs | 2 +- .../{massrebuildjob.rs => evaluationjob.rs} | 12 ++++------ ofborg/src/message/mod.rs | 2 +- .../tasks/{massrebuilder.rs => evaluate.rs} | 24 +++++++++---------- ofborg/src/tasks/evaluationfilter.rs | 6 ++--- ofborg/src/tasks/githubcommentfilter.rs | 4 ++-- ofborg/src/tasks/mod.rs | 2 +- 7 files changed, 24 insertions(+), 28 deletions(-) rename ofborg/src/message/{massrebuildjob.rs => evaluationjob.rs} (51%) rename ofborg/src/tasks/{massrebuilder.rs => evaluate.rs} (97%) diff --git a/ofborg/src/bin/mass-rebuilder.rs b/ofborg/src/bin/mass-rebuilder.rs index 277cb26..c6322c8 100644 --- a/ofborg/src/bin/mass-rebuilder.rs +++ b/ofborg/src/bin/mass-rebuilder.rs @@ -47,7 +47,7 @@ fn main() { session.open_channel(3).unwrap(), ); - let mrw = tasks::massrebuilder::MassRebuildWorker::new( + let mrw = tasks::evaluate::EvaluationWorker::new( cloner, &nix, cfg.github(), diff --git a/ofborg/src/message/massrebuildjob.rs b/ofborg/src/message/evaluationjob.rs similarity index 51% rename from ofborg/src/message/massrebuildjob.rs rename to ofborg/src/message/evaluationjob.rs index a80c16b..b16a52d 100644 --- a/ofborg/src/message/massrebuildjob.rs +++ b/ofborg/src/message/evaluationjob.rs @@ -2,12 +2,12 @@ use ofborg::message::{Pr, Repo}; use ofborg::worker; use serde_json; -pub fn from(data: &[u8]) -> Result { +pub fn from(data: &[u8]) -> Result { serde_json::from_slice(&data) } #[derive(Serialize, Deserialize, Debug)] -pub struct MassRebuildJob { +pub struct EvaluationJob { pub repo: Repo, pub pr: Pr, } @@ -15,15 +15,11 @@ pub struct MassRebuildJob { pub struct Actions {} impl Actions { - pub fn skip(&mut self, _job: &MassRebuildJob) -> worker::Actions { + pub fn skip(&mut self, _job: &EvaluationJob) -> worker::Actions { vec![worker::Action::Ack] } - pub fn done( - &mut self, - _job: &MassRebuildJob, - mut response: worker::Actions, - ) -> worker::Actions { + pub fn done(&mut self, _job: &EvaluationJob, mut response: worker::Actions) -> worker::Actions { response.push(worker::Action::Ack); response } diff --git a/ofborg/src/message/mod.rs b/ofborg/src/message/mod.rs index fde351f..03551cd 100644 --- a/ofborg/src/message/mod.rs +++ b/ofborg/src/message/mod.rs @@ -2,6 +2,6 @@ pub mod buildjob; pub mod buildlogmsg; pub mod buildresult; mod common; -pub mod massrebuildjob; +pub mod evaluationjob; pub use self::common::{Pr, Repo}; diff --git a/ofborg/src/tasks/massrebuilder.rs b/ofborg/src/tasks/evaluate.rs similarity index 97% rename from ofborg/src/tasks/massrebuilder.rs rename to ofborg/src/tasks/evaluate.rs index bc592f1..3c2ac9e 100644 --- a/ofborg/src/tasks/massrebuilder.rs +++ b/ofborg/src/tasks/evaluate.rs @@ -1,4 +1,4 @@ -/// This is what evaluates every pull-requests +/// This is what evaluates every pull-request extern crate amqp; extern crate env_logger; extern crate uuid; @@ -14,7 +14,7 @@ use ofborg::commentparser::Subset; use ofborg::commitstatus::CommitStatus; use ofborg::evalchecker::EvalChecker; use ofborg::files::file_to_str; -use ofborg::message::{buildjob, massrebuildjob}; +use ofborg::message::{buildjob, evaluationjob}; use ofborg::nix; use ofborg::outpathdiff::{OutPathDiff, OutPaths}; use ofborg::stats; @@ -31,7 +31,7 @@ use std::time::Instant; use tasks::eval; use uuid::Uuid; -pub struct MassRebuildWorker { +pub struct EvaluationWorker { cloner: checkout::CachedCloner, nix: nix::Nix, github: hubcaps::Github, @@ -41,7 +41,7 @@ pub struct MassRebuildWorker { tag_paths: HashMap>, } -impl MassRebuildWorker { +impl EvaluationWorker { pub fn new( cloner: checkout::CachedCloner, nix: &nix::Nix, @@ -50,8 +50,8 @@ impl MassRebuildWorker { identity: String, events: E, tag_paths: HashMap>, - ) -> MassRebuildWorker { - MassRebuildWorker { + ) -> EvaluationWorker { + EvaluationWorker { cloner, nix: nix.without_limited_supported_systems(), github, @@ -62,8 +62,8 @@ impl MassRebuildWorker { } } - fn actions(&self) -> massrebuildjob::Actions { - massrebuildjob::Actions {} + fn actions(&self) -> evaluationjob::Actions { + evaluationjob::Actions {} } fn tag_from_title(&self, issue: &hubcaps::issues::IssueRef) { @@ -91,8 +91,8 @@ impl MassRebuildWorker { } } -impl worker::SimpleWorker for MassRebuildWorker { - type J = massrebuildjob::MassRebuildJob; +impl worker::SimpleWorker for EvaluationWorker { + type J = evaluationjob::EvaluationJob; fn msg_to_job( &mut self, @@ -101,7 +101,7 @@ impl worker::SimpleWorker for MassRebuildWorker Result { self.events.notify(Event::JobReceived); - match massrebuildjob::from(body) { + match evaluationjob::from(body) { Ok(e) => { self.events.notify(Event::JobDecodeSuccess); Ok(e) @@ -118,7 +118,7 @@ impl worker::SimpleWorker for MassRebuildWorker worker::Actions { + fn consumer(&mut self, job: &evaluationjob::EvaluationJob) -> worker::Actions { let repo = self .github .repo(job.repo.owner.clone(), job.repo.name.clone()); diff --git a/ofborg/src/tasks/evaluationfilter.rs b/ofborg/src/tasks/evaluationfilter.rs index 4d300fd..26e0b00 100644 --- a/ofborg/src/tasks/evaluationfilter.rs +++ b/ofborg/src/tasks/evaluationfilter.rs @@ -6,7 +6,7 @@ use ofborg::ghevent; use serde_json; use amqp::protocol::basic::{BasicProperties, Deliver}; -use ofborg::message::{massrebuildjob, Pr, Repo}; +use ofborg::message::{evaluationjob, Pr, Repo}; use ofborg::worker; pub struct EvaluationFilterWorker { @@ -92,7 +92,7 @@ impl worker::SimpleWorker for EvaluationFilterWorker { target_branch: Some(job.pull_request.base.git_ref.clone()), }; - let msg = massrebuildjob::MassRebuildJob { + let msg = evaluationjob::EvaluationJob { repo: repo_msg.clone(), pr: pr_msg.clone(), }; @@ -128,7 +128,7 @@ mod tests { worker::publish_serde_action( None, Some("mass-rebuild-check-jobs".to_owned()), - &massrebuildjob::MassRebuildJob { + &evaluationjob::EvaluationJob { repo: Repo { clone_url: String::from("https://github.com/NixOS/nixpkgs.git"), full_name: String::from("NixOS/nixpkgs"), diff --git a/ofborg/src/tasks/githubcommentfilter.rs b/ofborg/src/tasks/githubcommentfilter.rs index cf3e5fd..850ac2f 100644 --- a/ofborg/src/tasks/githubcommentfilter.rs +++ b/ofborg/src/tasks/githubcommentfilter.rs @@ -10,7 +10,7 @@ use uuid::Uuid; use amqp::protocol::basic::{BasicProperties, Deliver}; use hubcaps; use ofborg::commentparser; -use ofborg::message::{buildjob, massrebuildjob, Pr, Repo}; +use ofborg::message::{buildjob, evaluationjob, Pr, Repo}; use ofborg::worker; pub struct GitHubCommentWorker { @@ -147,7 +147,7 @@ impl worker::SimpleWorker for GitHubCommentWorker { )); } commentparser::Instruction::Eval => { - let msg = massrebuildjob::MassRebuildJob { + let msg = evaluationjob::EvaluationJob { repo: repo_msg.clone(), pr: pr_msg.clone(), }; diff --git a/ofborg/src/tasks/mod.rs b/ofborg/src/tasks/mod.rs index d7ed9fb..5aab0fa 100644 --- a/ofborg/src/tasks/mod.rs +++ b/ofborg/src/tasks/mod.rs @@ -1,8 +1,8 @@ pub mod build; pub mod eval; +pub mod evaluate; pub mod evaluationfilter; pub mod githubcommentfilter; pub mod githubcommentposter; pub mod log_message_collector; -pub mod massrebuilder; pub mod statscollector;