Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

refactor(deploy): deployment_runner rides RunLifecycleMixin transitions (plan 77 D2)

Juan Denisf550ddc04fb6
diff --git a/backend/app/services/deployment_runner.py b/backend/app/services/deployment_runner.py
index 95e318f4..0d275447 100644
--- a/backend/app/services/deployment_runner.py
+++ b/backend/app/services/deployment_runner.py
@@ -48,8 +48,7 @@ class DeploymentPlanRunner:
# marks the job failed with a visible error instead of leaving it stuck
# at "running 0%" with no logs forever.
try:
- self.job.status = 'running'
- self.job.started_at = datetime.utcnow()
+ self.job.mark_running()
self.job.total_steps = len(steps)
db.session.commit()
@@ -92,8 +91,7 @@ class DeploymentPlanRunner:
result = self._execute_step(step)
results.append({'step': index, 'name': name, 'result': result})
- self.job.status = 'succeeded'
- self.job.completed_at = datetime.utcnow()
+ self.job.mark_succeeded()
self.job.current_step_name = None
self.job.set_result({'steps': results})
db.session.commit()
@@ -121,9 +119,7 @@ class DeploymentPlanRunner:
# than a missing log line.
try:
db.session.rollback()
- self.job.status = 'failed'
- self.job.completed_at = datetime.utcnow()
- self.job.error_message = str(exc)
+ self.job.mark_failed(str(exc))
self.job.set_result({'steps': results})
db.session.commit()
except Exception: