try to fix unknown builds with unknown build status
This commit is contained in:
parent
fb81009336
commit
9ca574cb94
1 changed files with 68 additions and 6 deletions
66
src/build.rs
66
src/build.rs
|
|
@ -62,6 +62,7 @@ struct BuildProgress {
|
|||
failed: u64,
|
||||
started_builds: VecDeque<u64>,
|
||||
reported_builds: VecDeque<BuildState>,
|
||||
unreported_builds: VecDeque<u64>,
|
||||
}
|
||||
|
||||
pub async fn build_loop(
|
||||
|
|
@ -208,13 +209,67 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
|||
}
|
||||
while failed > progress_entry.failed {
|
||||
progress_entry.failed += 1;
|
||||
if let Some(build_id) =
|
||||
progress_entry.unreported_builds.pop_front()
|
||||
{
|
||||
if let Some(entry) = activities.get_mut(&build_id) {
|
||||
match entry.r#type {
|
||||
NixInternalLogLineActivityType::Build => {
|
||||
let ActivityDataPerType::Build {
|
||||
drv_path,
|
||||
state,
|
||||
} = entry.data.as_mut().unwrap()
|
||||
else {
|
||||
panic!(
|
||||
"this can't happen (build activity without build data)"
|
||||
);
|
||||
};
|
||||
tracing::info!(
|
||||
"reported failed build for derivation {} after stop",
|
||||
drv_path
|
||||
);
|
||||
*state = BuildState::Failed;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
progress_entry
|
||||
.reported_builds
|
||||
.push_back(BuildState::Failed);
|
||||
}
|
||||
}
|
||||
while done > progress_entry.done {
|
||||
progress_entry.done += 1;
|
||||
progress_entry.reported_builds.push_back(BuildState::Done);
|
||||
if let Some(build_id) =
|
||||
progress_entry.unreported_builds.pop_front()
|
||||
{
|
||||
if let Some(entry) = activities.get_mut(&build_id) {
|
||||
match entry.r#type {
|
||||
NixInternalLogLineActivityType::Build => {
|
||||
let ActivityDataPerType::Build {
|
||||
drv_path,
|
||||
state,
|
||||
} = entry.data.as_mut().unwrap()
|
||||
else {
|
||||
panic!(
|
||||
"this can't happen (build activity without build data)"
|
||||
);
|
||||
};
|
||||
tracing::info!(
|
||||
"reported done build for derivation {} after stop",
|
||||
drv_path
|
||||
);
|
||||
*state = BuildState::Done;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
progress_entry
|
||||
.reported_builds
|
||||
.push_back(BuildState::Done);
|
||||
}
|
||||
}
|
||||
}
|
||||
// meta-progress counting the paths being downloaded as part of the build
|
||||
|
|
@ -270,6 +325,7 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
|||
failed: 0,
|
||||
started_builds: VecDeque::new(),
|
||||
reported_builds: VecDeque::new(),
|
||||
unreported_builds: VecDeque::new(),
|
||||
});
|
||||
}
|
||||
// just ignore this, we don't really care about these
|
||||
|
|
@ -326,6 +382,7 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
|||
tracing::warn!(
|
||||
"build stopped but no report (don't know whether it failed)"
|
||||
);
|
||||
progress_entry.unreported_builds.push_back(id);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
|
@ -355,8 +412,13 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
|||
}
|
||||
_ => {
|
||||
tracing::warn!("derivation {} somehow still running??", drv_path);
|
||||
// unknown build status -> assume it was built successfully if nix build did not return an error
|
||||
if exit_status.success() {
|
||||
BuildResultType::Built
|
||||
} else {
|
||||
BuildResultType::Unknown
|
||||
}
|
||||
}
|
||||
};
|
||||
results
|
||||
.entry(drv_path.clone())
|
||||
|
|
@ -368,7 +430,7 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
|||
.or_insert(result);
|
||||
}
|
||||
Some(ActivityDataPerType::Substitute { store_path }) => {
|
||||
tracing::info!("downloaded {}", store_path);
|
||||
tracing::trace!("downloaded {}", store_path);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue