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

View file

@ -178,7 +178,13 @@ impl worker::SimpleWorker for MassRebuildWorker {
hubcaps::statuses::State::Pending 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( overall_status.set_with_description(
format!("Failed to enumerate outputs after merging to {}", &target_branch).as_ref(), format!("Failed to enumerate outputs after merging to {}", &target_branch).as_ref(),
hubcaps::statuses::State::Failure hubcaps::statuses::State::Failure