forked from the-distro/ofborg
Rename check prefixes to ofborg
* If the sha we're operating on already has checks beginning with the old `grahamcofborg-` prefix (e.g. someone just used `@ofborg eval`, `@ofborg build`, or `@ofborg test`), continue using that prefix. * If the sha we're operating on doesn't have any checks beginning with the old `grahamcofborg-` prefix, use the new `ofborg-` prefix. This will take effect on all new PRs immediately, and after a force-push for all existing PRs.
This commit is contained in:
parent
491ebda5e3
commit
bc00b523ea
|
@ -20,8 +20,8 @@ impl EvalChecker {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> String {
|
||||
format!("grahamcofborg-eval-{}", self.name)
|
||||
pub fn name(&self) -> &str {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn execute(&self, path: &Path) -> Result<File, File> {
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::tagger::{
|
|||
use crate::tasks::eval::{
|
||||
stdenvs::Stdenvs, Error, EvaluationComplete, EvaluationStrategy, StepResult,
|
||||
};
|
||||
use crate::tasks::evaluate::{make_gist, update_labels};
|
||||
use crate::tasks::evaluate::{get_prefix, make_gist, update_labels};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
|
@ -272,6 +272,8 @@ impl<'a> NixpkgsStrategy<'a> {
|
|||
},
|
||||
);
|
||||
|
||||
let prefix = get_prefix(self.repo.statuses(), &self.job.pr.head_sha)?;
|
||||
|
||||
if changed_paths.len() > MAINTAINER_REVIEW_MAX_CHANGED_PATHS {
|
||||
info!(
|
||||
"pull request has {} changed paths, skipping review requests",
|
||||
|
@ -280,7 +282,7 @@ impl<'a> NixpkgsStrategy<'a> {
|
|||
let status = CommitStatus::new(
|
||||
self.repo.statuses(),
|
||||
self.job.pr.head_sha.clone(),
|
||||
String::from("grahamcofborg-eval-check-maintainers"),
|
||||
format!("{}-eval-check-maintainers", prefix),
|
||||
String::from("large change, skipping automatic review requests"),
|
||||
gist_url,
|
||||
);
|
||||
|
@ -291,7 +293,7 @@ impl<'a> NixpkgsStrategy<'a> {
|
|||
let status = CommitStatus::new(
|
||||
self.repo.statuses(),
|
||||
self.job.pr.head_sha.clone(),
|
||||
String::from("grahamcofborg-eval-check-maintainers"),
|
||||
format!("{}-eval-check-maintainers", prefix),
|
||||
String::from("matching changed paths to changed attrs..."),
|
||||
gist_url,
|
||||
);
|
||||
|
@ -315,10 +317,12 @@ impl<'a> NixpkgsStrategy<'a> {
|
|||
|
||||
fn check_meta_queue_builds(&self, dir: &Path) -> StepResult<Vec<BuildJob>> {
|
||||
if let Some(ref possibly_touched_packages) = self.touched_packages {
|
||||
let prefix = get_prefix(self.repo.statuses(), &self.job.pr.head_sha)?;
|
||||
|
||||
let mut status = CommitStatus::new(
|
||||
self.repo.statuses(),
|
||||
self.job.pr.head_sha.clone(),
|
||||
String::from("grahamcofborg-eval-check-meta"),
|
||||
format!("{}-eval-check-meta", prefix),
|
||||
String::from("config.nix: checkMeta = true"),
|
||||
None,
|
||||
);
|
||||
|
|
|
@ -186,9 +186,13 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
|
|||
} else {
|
||||
description
|
||||
};
|
||||
let repo = self
|
||||
.client_app
|
||||
.repo(self.job.repo.owner.clone(), self.job.repo.name.clone());
|
||||
let prefix = get_prefix(repo.statuses(), &self.job.pr.head_sha)?;
|
||||
|
||||
let mut builder = hubcaps::statuses::StatusOptions::builder(state);
|
||||
builder.context("grahamcofborg-eval");
|
||||
builder.context(format!("{}-eval", prefix));
|
||||
builder.description(description.clone());
|
||||
|
||||
if let Some(url) = url {
|
||||
|
@ -322,10 +326,12 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
|
|||
Box::new(eval::GenericStrategy::new())
|
||||
};
|
||||
|
||||
let prefix = get_prefix(repo.statuses(), &job.pr.head_sha)?;
|
||||
|
||||
let mut overall_status = CommitStatus::new(
|
||||
repo.statuses(),
|
||||
job.pr.head_sha.clone(),
|
||||
"grahamcofborg-eval".to_owned(),
|
||||
format!("{}-eval", &prefix),
|
||||
"Starting".to_owned(),
|
||||
None,
|
||||
);
|
||||
|
@ -422,7 +428,7 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
|
|||
let mut status = CommitStatus::new(
|
||||
repo.statuses(),
|
||||
job.pr.head_sha.clone(),
|
||||
check.name(),
|
||||
format!("{}-eval-{}", prefix, check.name()),
|
||||
check.cli_cmd(),
|
||||
None,
|
||||
);
|
||||
|
@ -441,7 +447,7 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
|
|||
Err(mut out) => {
|
||||
state = hubcaps::statuses::State::Failure;
|
||||
gist_url = self.make_gist(
|
||||
&check.name(),
|
||||
&format!("{}-eval-{}", prefix, check.name()),
|
||||
Some(format!("{:?}", state)),
|
||||
file_to_str(&mut out),
|
||||
);
|
||||
|
@ -618,6 +624,28 @@ fn indicates_wip(text: &str) -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
/// Determine whether or not to use the "old" status prefix, `grahamcofborg`, or
|
||||
/// the new one, `ofborg`.
|
||||
///
|
||||
/// If the PR already has any `grahamcofborg`-prefixed statuses, continue to use
|
||||
/// that (e.g. if someone used `@ofborg eval`, `@ofborg build`, `@ofborg test`).
|
||||
/// Otherwise, if it's a new PR or was recently force-pushed (and therefore
|
||||
/// doesn't have any old `grahamcofborg`-prefixed statuses), use the new prefix.
|
||||
pub fn get_prefix<'a>(
|
||||
statuses: hubcaps::statuses::Statuses,
|
||||
sha: &'a str,
|
||||
) -> Result<&'a str, CommitStatusError> {
|
||||
if statuses
|
||||
.list(&sha)?
|
||||
.iter()
|
||||
.any(|s| s.context.starts_with("grahamcofborg-"))
|
||||
{
|
||||
Ok("grahamcofborg")
|
||||
} else {
|
||||
Ok("ofborg")
|
||||
}
|
||||
}
|
||||
|
||||
enum EvalWorkerError {
|
||||
EvalError(eval::Error),
|
||||
CommitStatusWrite(CommitStatusError),
|
||||
|
|
Loading…
Reference in a new issue