コード例 #1
0
 private function run()
 {
     // Note that a pipeline must be started prior to being picked up by this task
     $runningPipelines = Pipeline::get()->filter('Status', array('Running', 'Rollback'));
     printf("%s Checking status of %d pipelines... ", "[" . date("Y-m-d H:i:s") . "]", $runningPipelines->count());
     foreach ($runningPipelines as $pipeline) {
         $pipeline->checkPipelineStatus();
     }
     echo "done!" . PHP_EOL;
 }
コード例 #2
0
ファイル: DNRoot.php プロジェクト: udomsak/deploynaut
 /**
  * @param SS_HTTPRequest $request
  *
  * @return SS_HTTPResponse
  * @throws SS_HTTPResponse_Exception
  */
 public function pipeline(SS_HTTPRequest $request)
 {
     $params = $request->params();
     $pipeline = Pipeline::get()->byID($params['Identifier']);
     if (!$pipeline || !$pipeline->ID || !$pipeline->Environment()) {
         throw new SS_HTTPResponse_Exception('Pipeline not found', 404);
     }
     if (!$pipeline->Environment()->canView()) {
         return Security::permissionFailure();
     }
     $environment = $pipeline->Environment();
     $project = $pipeline->Environment()->Project();
     if ($environment->Name != $params['Environment']) {
         throw new LogicException("Environment in URL doesn't match this pipeline");
     }
     if ($project->Name != $params['Project']) {
         throw new LogicException("Project in URL doesn't match this pipeline");
     }
     // Delegate to sub-requesthandler
     return PipelineController::create($this, $pipeline);
 }
コード例 #3
0
 public function testMarkCompleteRollback()
 {
     $pipeline = $this->getFailingPipeline();
     // Trigger rollback.
     $pipeline->markFailed();
     // Succeed the rollback.
     $pipeline->RollbackStep1()->finish();
     $pipeline->RollbackStep2()->finish();
     // Progress the pipeline. Will call markFailed.
     $pipeline->checkPipelineStatus();
     $this->assertHasLog('Pipeline failed, but rollback completed successfully.');
     $pipeline = Pipeline::get()->byID($pipeline->ID);
     $this->assertTrue($pipeline->isFailed());
     $this->assertFalse($pipeline->isRollback());
     $this->assertEquals($pipeline->RollbackStep1()->Status, 'Finished');
     $this->assertEquals($pipeline->RollbackStep2()->Status, 'Finished');
     $this->assertEquals($pipeline->Status, 'Failed');
 }