|
@@ 828-851 (lines=24) @@
|
| 825 |
|
* @return SS_HTTPResponse |
| 826 |
|
* @throws SS_HTTPResponse_Exception |
| 827 |
|
*/ |
| 828 |
|
public function pipeline(SS_HTTPRequest $request) { |
| 829 |
|
$params = $request->params(); |
| 830 |
|
$pipeline = Pipeline::get()->byID($params['Identifier']); |
| 831 |
|
|
| 832 |
|
if(!$pipeline || !$pipeline->ID || !$pipeline->Environment()) { |
| 833 |
|
throw new SS_HTTPResponse_Exception('Pipeline not found', 404); |
| 834 |
|
} |
| 835 |
|
if(!$pipeline->Environment()->canView()) { |
| 836 |
|
return Security::permissionFailure(); |
| 837 |
|
} |
| 838 |
|
|
| 839 |
|
$environment = $pipeline->Environment(); |
| 840 |
|
$project = $pipeline->Environment()->Project(); |
| 841 |
|
|
| 842 |
|
if($environment->Name != $params['Environment']) { |
| 843 |
|
throw new LogicException("Environment in URL doesn't match this pipeline"); |
| 844 |
|
} |
| 845 |
|
if($project->Name != $params['Project']) { |
| 846 |
|
throw new LogicException("Project in URL doesn't match this pipeline"); |
| 847 |
|
} |
| 848 |
|
|
| 849 |
|
// Delegate to sub-requesthandler |
| 850 |
|
return PipelineController::create($this, $pipeline); |
| 851 |
|
} |
| 852 |
|
|
| 853 |
|
/** |
| 854 |
|
* Shows the creation log. |
|
@@ 1502-1526 (lines=25) @@
|
| 1499 |
|
* @return SS_HTTPResponse|string |
| 1500 |
|
* @throws SS_HTTPResponse_Exception |
| 1501 |
|
*/ |
| 1502 |
|
public function deploy(SS_HTTPRequest $request) { |
| 1503 |
|
$params = $request->params(); |
| 1504 |
|
$deployment = DNDeployment::get()->byId($params['Identifier']); |
| 1505 |
|
|
| 1506 |
|
if(!$deployment || !$deployment->ID) { |
| 1507 |
|
throw new SS_HTTPResponse_Exception('Deployment not found', 404); |
| 1508 |
|
} |
| 1509 |
|
if(!$deployment->canView()) { |
| 1510 |
|
return Security::permissionFailure(); |
| 1511 |
|
} |
| 1512 |
|
|
| 1513 |
|
$environment = $deployment->Environment(); |
| 1514 |
|
$project = $environment->Project(); |
| 1515 |
|
|
| 1516 |
|
if($environment->Name != $params['Environment']) { |
| 1517 |
|
throw new LogicException("Environment in URL doesn't match this deploy"); |
| 1518 |
|
} |
| 1519 |
|
if($project->Name != $params['Project']) { |
| 1520 |
|
throw new LogicException("Project in URL doesn't match this deploy"); |
| 1521 |
|
} |
| 1522 |
|
|
| 1523 |
|
return $this->render(array( |
| 1524 |
|
'Deployment' => $deployment, |
| 1525 |
|
)); |
| 1526 |
|
} |
| 1527 |
|
|
| 1528 |
|
|
| 1529 |
|
/** |
|
@@ 1568-1592 (lines=25) @@
|
| 1565 |
|
return $this->sendResponse($deployment->ResqueStatus(), $content); |
| 1566 |
|
} |
| 1567 |
|
|
| 1568 |
|
public function abortDeploy(SS_HTTPRequest $request) { |
| 1569 |
|
$params = $request->params(); |
| 1570 |
|
$deployment = DNDeployment::get()->byId($params['Identifier']); |
| 1571 |
|
|
| 1572 |
|
if(!$deployment || !$deployment->ID) { |
| 1573 |
|
throw new SS_HTTPResponse_Exception('Deployment not found', 404); |
| 1574 |
|
} |
| 1575 |
|
if(!$deployment->canView()) { |
| 1576 |
|
return Security::permissionFailure(); |
| 1577 |
|
} |
| 1578 |
|
|
| 1579 |
|
$environment = $deployment->Environment(); |
| 1580 |
|
$project = $environment->Project(); |
| 1581 |
|
|
| 1582 |
|
if($environment->Name != $params['Environment']) { |
| 1583 |
|
throw new LogicException("Environment in URL doesn't match this deploy"); |
| 1584 |
|
} |
| 1585 |
|
if($project->Name != $params['Project']) { |
| 1586 |
|
throw new LogicException("Project in URL doesn't match this deploy"); |
| 1587 |
|
} |
| 1588 |
|
|
| 1589 |
|
$deployment->abort(); |
| 1590 |
|
|
| 1591 |
|
return $this->sendResponse($deployment->ResqueStatus(), []); |
| 1592 |
|
} |
| 1593 |
|
|
| 1594 |
|
/** |
| 1595 |
|
* @param SS_HTTPRequest|null $request |