Rename mass-rebuilder things to evaluation

This commit is contained in:
Graham Christensen 2019-03-21 18:09:18 -04:00
parent c8ae149731
commit 9c83a06ab1
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
7 changed files with 24 additions and 28 deletions

View file

@ -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(),

View file

@ -2,12 +2,12 @@ use ofborg::message::{Pr, Repo};
use ofborg::worker;
use serde_json;
pub fn from(data: &[u8]) -> Result<MassRebuildJob, serde_json::error::Error> {
pub fn from(data: &[u8]) -> Result<EvaluationJob, serde_json::error::Error> {
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
}

View file

@ -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};

View file

@ -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<E> {
pub struct EvaluationWorker<E> {
cloner: checkout::CachedCloner,
nix: nix::Nix,
github: hubcaps::Github,
@ -41,7 +41,7 @@ pub struct MassRebuildWorker<E> {
tag_paths: HashMap<String, Vec<String>>,
}
impl<E: stats::SysEvents> MassRebuildWorker<E> {
impl<E: stats::SysEvents> EvaluationWorker<E> {
pub fn new(
cloner: checkout::CachedCloner,
nix: &nix::Nix,
@ -50,8 +50,8 @@ impl<E: stats::SysEvents> MassRebuildWorker<E> {
identity: String,
events: E,
tag_paths: HashMap<String, Vec<String>>,
) -> MassRebuildWorker<E> {
MassRebuildWorker {
) -> EvaluationWorker<E> {
EvaluationWorker {
cloner,
nix: nix.without_limited_supported_systems(),
github,
@ -62,8 +62,8 @@ impl<E: stats::SysEvents> MassRebuildWorker<E> {
}
}
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<E: stats::SysEvents> MassRebuildWorker<E> {
}
}
impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E> {
type J = massrebuildjob::MassRebuildJob;
impl<E: stats::SysEvents + 'static> worker::SimpleWorker for EvaluationWorker<E> {
type J = evaluationjob::EvaluationJob;
fn msg_to_job(
&mut self,
@ -101,7 +101,7 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
body: &[u8],
) -> Result<Self::J, String> {
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<E: stats::SysEvents + 'static> worker::SimpleWorker for MassRebuildWorker<E
}
}
fn consumer(&mut self, job: &massrebuildjob::MassRebuildJob) -> worker::Actions {
fn consumer(&mut self, job: &evaluationjob::EvaluationJob) -> worker::Actions {
let repo = self
.github
.repo(job.repo.owner.clone(), job.repo.name.clone());

View file

@ -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"),

View file

@ -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(),
};

View file

@ -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;