If output path diffing fails in the After step, upload the error log

This commit is contained in:
Graham Christensen 2017-12-05 07:22:01 -05:00
parent 7c11535ef0
commit 55e8e42d1f
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 25 additions and 20 deletions

View file

@ -9,7 +9,6 @@ use std::io::BufReader;
use std::path::PathBuf;
use ofborg::nix;
use std::io::Write;
use ofborg::evalchecker::EvalChecker;
pub struct OutPathDiff {
path: PathBuf,
@ -66,21 +65,21 @@ impl OutPathDiff {
}
}
pub fn find_after(&mut self) -> bool {
pub fn find_after(&mut self) -> Result<bool, File> {
if self.original == None {
debug!("Before is None, not bothering with After");
return false;
return Ok(false);
}
let x = self.run();
match x {
Ok(f) => {
self.current = Some(self.parse(f));
return true;
return Ok(true);
}
Err(_) => {
Err(e) => {
info!("Failed to find After list");
return false;
return Err(e);
}
}
}
@ -131,18 +130,18 @@ impl OutPathDiff {
}
fn execute(&self) -> Result<File, File>{
let checker = EvalChecker::new("out-paths",
"nix-env",
vec![
String::from("-f"),
String::from(".gc-of-borg-out-list.nix"),
String::from("-qaP"),
String::from("--no-name"),
String::from("--out-path"),
String::from("--show-trace"),
],
self.nix.clone()
);
checker.execute(&self.path)
self.nix.safely(
"nix-env",
&self.path,
vec![
String::from("-f"),
String::from(".gc-of-borg-out-list.nix"),
String::from("-qaP"),
String::from("--no-name"),
String::from("--out-path"),
String::from("--show-trace"),
],
true
)
}
}

View file

@ -178,7 +178,13 @@ impl worker::SimpleWorker for MassRebuildWorker {
hubcaps::statuses::State::Pending
);
if !rebuildsniff.find_after() {
if let Err(mut output) = rebuildsniff.find_after() {
overall_status.set_url(make_gist(
&gists,
"Output path comparison".to_owned(),
Some("".to_owned()),
file_to_str(&mut output),
));
overall_status.set_with_description(
format!("Failed to enumerate outputs after merging to {}", &target_branch).as_ref(),
hubcaps::statuses::State::Failure