forgive it for what is has done

This commit is contained in:
Lucy Hochkamp 2025-10-10 18:23:06 +02:00
parent f982e37fe5
commit ac4fdac3b7
No known key found for this signature in database

View file

@ -1,4 +1,7 @@
use std::collections::{HashMap, VecDeque};
use std::{
collections::{HashMap, VecDeque},
rc::Rc,
};
use tokio::{
process::Command,
@ -85,7 +88,7 @@ pub async fn build_loop(
};
if !paths_built.contains(&eval_job.drv_path) {
paths_built.push(eval_job.drv_path.clone());
match run_build(job.attr, eval_job.drv_path.clone()).await {
match run_build(job.attr, eval_job.drv_path.clone(), copy_tx.clone()).await {
Err(e) => {
let _ = result_tx
.send(NixCiResult {
@ -116,8 +119,12 @@ pub async fn build_loop(
}
}
#[tracing::instrument(skip(drv_path))]
pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<BuildResult>> {
#[tracing::instrument(skip(drv_path, copy_tx))]
pub async fn run_build(
attr: String,
drv_path: String,
copy_tx: Sender<CopyLoopMessage>,
) -> anyhow::Result<Vec<BuildResult>> {
let mut child = WrappedChild::new(
Command::new("nix")
.args(&[
@ -386,7 +393,40 @@ pub async fn run_build(attr: String, drv_path: String) -> anyhow::Result<Vec<Bui
}
}
_ => {}
}
};
match entry.data.as_ref() {
Some(ActivityDataPerType::Build { drv_path, state }) => {
let result = match state {
BuildState::Done => {
tracing::info!("derivation {} built successfully", drv_path);
BuildResultType::Built
}
BuildState::Failed => {
tracing::error!("derivation {} failed to build", drv_path);
BuildResultType::Failed
}
_ => {
tracing::warn!(
"derivation {} somehow still running??",
drv_path
);
// unknown build status -> assume it was built successfully if nix build did not return an error
BuildResultType::Unknown
}
};
if let Err(e) = copy_tx
.send(CopyLoopMessage::Build(BuildResult {
path: drv_path.to_string(),
result: result,
}))
.await
{
tracing::error!("failed to enqueue package copy: {}", e);
break;
}
}
_ => {}
};
}
}
}