failure handling on steps, setting service status

This commit is contained in:
2025-03-31 16:45:36 +00:00
parent 967a87a024
commit 9854b42f47
3 changed files with 21 additions and 0 deletions

View File

@@ -70,4 +70,21 @@ class RunStep implements ShouldQueue
]);
}
}
public function failed(\Throwable $exception): void
{
$this->step->update([
'status' => DeploymentStatus::FAILED,
'finished_at' => now(),
'logs' => $this->step->logs . "\n" . trim($exception->getMessage()),
]);
$this->step->deployment->steps()->where('order', '>', $this->step->order)->update([
'status' => DeploymentStatus::CANCELLED,
]);
$this->step->deployment->update([
'status' => DeploymentStatus::FAILED,
]);
}
}