From 302f224bc063be2757acdaf8fef61eb4f98f6427 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 4 Apr 2023 14:23:10 +0200 Subject: [PATCH] fix: deployment should fail on error --- app/Actions/RemoteProcess/RunRemoteProcess.php | 3 +++ app/Jobs/DeployApplicationJob.php | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Actions/RemoteProcess/RunRemoteProcess.php b/app/Actions/RemoteProcess/RunRemoteProcess.php index 53e0beb10..a9aadb09f 100644 --- a/app/Actions/RemoteProcess/RunRemoteProcess.php +++ b/app/Actions/RemoteProcess/RunRemoteProcess.php @@ -71,6 +71,9 @@ class RunRemoteProcess $this->activity->save(); + if ($processResult->exitCode() != 0 && $processResult->errorOutput()) { + throw new \RuntimeException('Remote command failed'); + } return $processResult; } diff --git a/app/Jobs/DeployApplicationJob.php b/app/Jobs/DeployApplicationJob.php index 3e2e86735..223aefa1b 100644 --- a/app/Jobs/DeployApplicationJob.php +++ b/app/Jobs/DeployApplicationJob.php @@ -279,15 +279,13 @@ class DeployApplicationJob implements ShouldQueue 'hideFromOutput' => $hideFromOutput, 'setStatus' => $setStatus, ]); + $result = $remoteProcess(); if ($propertyName) { - $result = $remoteProcess(); $this->activity->properties = $this->activity->properties->merge([ $propertyName => trim($result->output()), ]); $this->activity->save(); - } else { - $remoteProcess(); } } private function gitImport()