From 7cd771ad1349e5367db9c45da6225ee59966f96e Mon Sep 17 00:00:00 2001 From: "Harry (hjbdev)" Date: Mon, 31 Mar 2025 16:25:14 +0000 Subject: [PATCH] fail properly --- app/Jobs/Services/RunStep.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Services/RunStep.php b/app/Jobs/Services/RunStep.php index 2986c7b..709039d 100644 --- a/app/Jobs/Services/RunStep.php +++ b/app/Jobs/Services/RunStep.php @@ -37,7 +37,17 @@ class RunStep implements ShouldQueue ]); }); - $ssh->execute($this->step->script); + $result = $ssh->execute($this->step->script); + + if (! $result->isSuccessful()) { + $this->step->update([ + 'status' => DeploymentStatus::FAILED, + 'finished_at' => now(), + 'logs' => $this->step->logs . "\n" . trim($result->getErrorOutput()), + ]); + + return; + } $this->step->update([ 'status' => DeploymentStatus::COMPLETED,