/**
  * Cleans up any stalled deployments in the database.
  *
  * @tpdp Maybe readd pending to the queue if possible?
  * @return void
  */
 public function cleanupDeployments()
 {
     // Mark any pending steps as cancelled
     ServerLog::where('status', '=', ServerLog::PENDING)->update(['status' => ServerLog::CANCELLED]);
     // Mark any running steps as failed
     ServerLog::where('status', '=', ServerLog::RUNNING)->update(['status' => ServerLog::FAILED]);
     // Mark any running/pending deployments as failed
     Deployment::whereIn('status', [Deployment::DEPLOYING, Deployment::PENDING])->update(['status' => Deployment::FAILED]);
     // Mark any deploying/pending projects as failed
     Project::whereIn('status', [Project::DEPLOYING, Project::PENDING])->update(['status' => Project::FAILED]);
 }
Esempio n. 2
0
 /**
  * Checks if there are any running or pending deployments.
  *
  * @return bool
  */
 protected function hasRunningDeployments()
 {
     $deploys = Deployment::whereIn('status', [Deployment::DEPLOYING, Deployment::PENDING])->count();
     if ($deploys > 0) {
         $this->block(['Deployments in progress', PHP_EOL, 'There are still running deployments, please wait for them to finish before updating.']);
         return true;
     }
     return false;
 }