forked from the-distro/ofborg
evaluator: move out title-based tagging
This commit is contained in:
parent
795ace48df
commit
297dd02f62
|
@ -3,8 +3,9 @@ use ofborg::checkout::CachedProjectCo;
|
|||
use ofborg::commitstatus::CommitStatus;
|
||||
use ofborg::evalchecker::EvalChecker;
|
||||
use ofborg::message::buildjob::BuildJob;
|
||||
use ofborg::tasks::eval::{EvaluationStrategy, StepResult};
|
||||
use ofborg::tasks::evaluate::update_labels;
|
||||
use std::path::Path;
|
||||
use tasks::eval::{EvaluationStrategy, StepResult};
|
||||
|
||||
pub struct NixpkgsStrategy<'a> {
|
||||
issue_ref: &'a IssueRef<'a>,
|
||||
|
@ -13,10 +14,26 @@ impl<'a> NixpkgsStrategy<'a> {
|
|||
pub fn new(issue_ref: &'a IssueRef) -> NixpkgsStrategy<'a> {
|
||||
Self { issue_ref }
|
||||
}
|
||||
|
||||
fn tag_from_title(&self) {
|
||||
let darwin = self
|
||||
.issue_ref
|
||||
.get()
|
||||
.map(|iss| {
|
||||
iss.title.to_lowercase().contains("darwin")
|
||||
|| iss.title.to_lowercase().contains("macos")
|
||||
})
|
||||
.unwrap_or(false);
|
||||
|
||||
if darwin {
|
||||
update_labels(&self.issue_ref, &[String::from("6.topic: darwin")], &[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> EvaluationStrategy for NixpkgsStrategy<'a> {
|
||||
fn pre_clone(&mut self) -> StepResult<()> {
|
||||
self.tag_from_title();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -68,20 +68,6 @@ impl<E: stats::SysEvents> EvaluationWorker<E> {
|
|||
evaluationjob::Actions {}
|
||||
}
|
||||
|
||||
fn tag_from_title(&self, issue: &hubcaps::issues::IssueRef) {
|
||||
let darwin = issue
|
||||
.get()
|
||||
.map(|iss| {
|
||||
iss.title.to_lowercase().contains("darwin")
|
||||
|| iss.title.to_lowercase().contains("macos")
|
||||
})
|
||||
.unwrap_or(false);
|
||||
|
||||
if darwin {
|
||||
update_labels(&issue, &[String::from("6.topic: darwin")], &[]);
|
||||
}
|
||||
}
|
||||
|
||||
fn tag_from_paths(&self, issue: &hubcaps::issues::IssueRef, paths: &[String]) {
|
||||
let mut tagger = PathsTagger::new(self.tag_paths.clone());
|
||||
|
||||
|
@ -185,8 +171,6 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for EvaluationWorker<E>
|
|||
}
|
||||
};
|
||||
|
||||
self.tag_from_title(&issue_ref);
|
||||
|
||||
let mut overall_status = CommitStatus::new(
|
||||
repo.statuses(),
|
||||
job.pr.head_sha.clone(),
|
||||
|
@ -197,6 +181,13 @@ impl<E: stats::SysEvents + 'static> worker::SimpleWorker for EvaluationWorker<E>
|
|||
|
||||
overall_status.set_with_description("Starting", hubcaps::statuses::State::Pending);
|
||||
|
||||
if self
|
||||
.handle_strategy_err(evaluation_strategy.pre_clone(), &gists, &mut overall_status)
|
||||
.is_err()
|
||||
{
|
||||
return self.actions().skip(&job);
|
||||
}
|
||||
|
||||
let project = self
|
||||
.cloner
|
||||
.project(&job.repo.full_name, job.repo.clone_url.clone());
|
||||
|
|
Loading…
Reference in a new issue