diff --git a/app/Jobs/Services/RunStep.php b/app/Jobs/Services/RunStep.php index 9d19c4a..9b9414b 100644 --- a/app/Jobs/Services/RunStep.php +++ b/app/Jobs/Services/RunStep.php @@ -7,6 +7,7 @@ use App\Enums\ServiceStatus; use App\Models\Step; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Queue\Queueable; +use Symfony\Component\Process\Process; class RunStep implements ShouldQueue { @@ -29,10 +30,16 @@ class RunStep implements ShouldQueue $server = $this->step->deployment->target->server; $ssh = $server->sshClient() - ->onOutput(function ($output) { - $this->step->update([ - 'logs' => $this->step->logs."\n".trim($output), - ]); + ->onOutput(function ($type, $output) { + if ($type === Process::OUT) { + $this->step->update([ + 'logs' => $this->step->logs . "\n" . trim($output), + ]); + } else { + $this->step->update([ + 'error_logs' => $this->step->error_logs . "\n" . trim($output), + ]); + } }); $result = $ssh->execute($this->step->script); @@ -41,7 +48,7 @@ class RunStep implements ShouldQueue $this->step->update([ 'status' => DeploymentStatus::FAILED, 'finished_at' => now(), - 'logs' => $this->step->logs."\n".trim($result->getErrorOutput()), + 'error_logs' => $this->step->error_logs . "\n" . trim($result->getErrorOutput()), ]); return; @@ -72,7 +79,7 @@ class RunStep implements ShouldQueue $this->step->update([ 'status' => DeploymentStatus::FAILED, 'finished_at' => now(), - 'logs' => $this->step->logs."\n".trim($exception->getMessage()), + 'error_logs' => $this->step->error_logs . "\n" . trim($exception->getMessage()), ]); $this->step->deployment->steps()->where('order', '>', $this->step->order)->update([ diff --git a/database/migrations/2025_03_31_141005_create_steps_table.php b/database/migrations/2025_03_31_141005_create_steps_table.php index 2e35ac5..1ba49ed 100644 --- a/database/migrations/2025_03_31_141005_create_steps_table.php +++ b/database/migrations/2025_03_31_141005_create_steps_table.php @@ -17,6 +17,7 @@ return new class extends Migration $table->string('status'); $table->longText('script'); $table->longText('logs')->nullable(); + $table->longText('error_logs')->nullable(); $table->text('secrets')->nullable(); $table->dateTime('started_at')->nullable(); $table->dateTime('finished_at')->nullable(); diff --git a/resources/js/pages/servers/Show.vue b/resources/js/pages/servers/Show.vue index 669b186..c14e94a 100644 --- a/resources/js/pages/servers/Show.vue +++ b/resources/js/pages/servers/Show.vue @@ -103,9 +103,17 @@ watch(counter, () => {
{{ deployment.target.name }}
-
+
- {{ step }} +
+ {{ step.name ?? 'Unnamed Step' }} +
+
+ {{ step.error_logs }} +
+
+ {{ step.logs }} +