fix: improve docker logs collection in docker mode

This commit is contained in:
Ruben Fiszel
2025-07-28 23:48:28 +00:00
parent 454b258ab8
commit ce4177ebae
+16 -14
View File
@@ -372,6 +372,7 @@ async fn handle_docker_job(
.await;
loop {
tokio::select! {
biased;
log = log_stream.next() => {
match log {
Some(Ok(log)) => {
@@ -466,21 +467,22 @@ async fn handle_docker_job(
rm_container(&client, &container_id).await;
return Err(e);
} else {
let _ = tokio::time::timeout(tokio::time::Duration::from_secs(5), logs).await;
rm_container(&client, &container_id).await;
let result = result.unwrap();
if result.is_some_and(|x| x > 0) {
return Err(Error::ExecutionErr(format!(
"Docker job completed with unsuccessful exit status: {}",
result.unwrap()
)));
}
return Ok(to_raw_value(&json!(format!(
"Docker job completed with success exit status"
))));
}
rm_container(&client, &container_id).await;
let result = result.unwrap();
if result.is_some_and(|x| x > 0) {
return Err(Error::ExecutionErr(format!(
"Docker job completed with unsuccessful exit status: {}",
result.unwrap()
)));
}
return Ok(to_raw_value(&json!(format!(
"Docker job completed with success exit status"
))));
}
#[cfg(feature = "dind")]