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
74
src/build.rs
74
src/build.rs
|
|
@ -62,6 +62,7 @@ struct BuildProgress {
|
||||||
failed: u64,
|
failed: u64,
|
||||||
started_builds: VecDeque<u64>,
|
started_builds: VecDeque<u64>,
|
||||||
reported_builds: VecDeque<BuildState>,
|
reported_builds: VecDeque<BuildState>,
|
||||||
|
unreported_builds: VecDeque<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn build_loop(
|
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 {
|
while failed > progress_entry.failed {
|
||||||
progress_entry.failed += 1;
|
progress_entry.failed += 1;
|
||||||
progress_entry
|
if let Some(build_id) =
|
||||||
.reported_builds
|
progress_entry.unreported_builds.pop_front()
|
||||||
.push_back(BuildState::Failed);
|
{
|
||||||
|
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 {
|
while done > progress_entry.done {
|
||||||
progress_entry.done += 1;
|
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
|
// 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,
|
failed: 0,
|
||||||
started_builds: VecDeque::new(),
|
started_builds: VecDeque::new(),
|
||||||
reported_builds: VecDeque::new(),
|
reported_builds: VecDeque::new(),
|
||||||
|
unreported_builds: VecDeque::new(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// just ignore this, we don't really care about these
|
// 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!(
|
tracing::warn!(
|
||||||
"build stopped but no report (don't know whether it failed)"
|
"build stopped but no report (don't know whether it failed)"
|
||||||
);
|
);
|
||||||
|
progress_entry.unreported_builds.push_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
@ -355,7 +412,12 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tracing::warn!("derivation {} somehow still running??", drv_path);
|
tracing::warn!("derivation {} somehow still running??", drv_path);
|
||||||
BuildResultType::Unknown
|
// 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
|
results
|
||||||
|
|
@ -368,7 +430,7 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
|
||||||
.or_insert(result);
|
.or_insert(result);
|
||||||
}
|
}
|
||||||
Some(ActivityDataPerType::Substitute { store_path }) => {
|
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