From b2fc28ad9fa908049f0d4def84637c659d3462f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 1 Dec 2026 01:42:55 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20release=20build=20shows?= =?UTF-8?q?=20podman's=20own=20error=20and=20a=20VM=20that=20fails=20to=20?= =?UTF-8?q?start=20only=20fails=20the=20Windows=20steps;=20linux=20builds?= =?UTF-8?q?=20still=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/release.rs | 49 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/crates/client/src/release.rs b/crates/client/src/release.rs index 1dd4a7f..13a2fb4 100644 --- a/crates/client/src/release.rs +++ b/crates/client/src/release.rs @@ -97,10 +97,11 @@ impl Cx { } } -#[derive(Clone, Copy)] -struct Vm { - present: bool, - started: bool, +enum Vm { + Missing, + Running, + Started, + Broken(String), } fn run(source: &Path, cx: &Cx) { @@ -119,7 +120,7 @@ fn run(source: &Path, cx: &Cx) { let result = if cx.cancelled() { Err("cancelled".to_string()) } else { - run_job(job, source, &key, cx, vm) + run_job(job, source, &key, cx, &vm) }; if let Err(e) = result { let e = if cx.cancelled() { @@ -131,7 +132,7 @@ fn run(source: &Path, cx: &Cx) { break; } } - if vm.started { + if let Vm::Started = vm { podman_ok(&["stop", VM]); } cx.send(Event::Done); @@ -148,24 +149,23 @@ fn preflight(source: &Path) -> Result { return Err("uncommitted changes".into()); } fs::create_dir_all(source.join("dist")).map_err(|e| e.to_string())?; - let present = podman_ok(&["container", "exists", VM]); - let mut started = false; - if present { - let state = Command::new("podman") - .args(["inspect", "-f", "{{.State.Running}}", VM]) - .output() - .map_err(|e| e.to_string())?; - if String::from_utf8_lossy(&state.stdout).trim() == "false" { - if !podman_ok(&["start", VM]) { - return Err("podman start failed".into()); - } - started = true; - } + if !podman_ok(&["container", "exists", VM]) { + return Ok(Vm::Missing); } - Ok(Vm { present, started }) + let state = Command::new("podman") + .args(["inspect", "-f", "{{.State.Running}}", VM]) + .output() + .map_err(|e| e.to_string())?; + if String::from_utf8_lossy(&state.stdout).trim() != "false" { + return Ok(Vm::Running); + } + Ok(match check(Command::new("podman").args(["start", VM])) { + Ok(()) => Vm::Started, + Err(error) => Vm::Broken(error), + }) } -fn run_job(job: Job, source: &Path, key: &Path, cx: &Cx, vm: Vm) -> Result<(), String> { +fn run_job(job: Job, source: &Path, key: &Path, cx: &Cx, vm: &Vm) -> Result<(), String> { match job { Job::Linux(level) => { if !cfg!(target_os = "linux") { @@ -175,14 +175,17 @@ fn run_job(job: Job, source: &Path, key: &Path, cx: &Cx, vm: Vm) -> Result<(), S build_linux(job, level, source, cx) } Job::WindowsStart => { - if !vm.present { + if let Vm::Missing = vm { return skip(cx, job, "no yumush-win"); } cx.send(Event::Started(job)); + if let Vm::Broken(error) = vm { + return Err(error.clone()); + } start_windows(job, source, key, cx) } Job::Windows(level) => { - if !vm.present { + if let Vm::Missing = vm { return skip(cx, job, "no yumush-win"); } cx.send(Event::Started(job));