/** * @param Deployment $deployment * @return void */ public function createAction(Deployment $deployment) { $deployment->setClientIp($this->request->getHttpRequest()->getClientIpAddress()); $this->deploymentRepository->add($deployment); $this->addFlashMessage('Created a new deployment.'); $this->redirect('index', NULL, NULL, array('deployment' => $deployment)); }
/** * @param string $key * @param SurfCaptainDeployment $surfCaptainDeployment * @return array */ protected function getSettingsForFunction($key, SurfCaptainDeployment $surfCaptainDeployment) { $settings = array_merge($this->settings, $this->settings[$key]); $repositoryUrl = $surfCaptainDeployment->getRepositoryUrl(); if (!empty($repositoryUrl) && !empty($settings[$repositoryUrl][$key])) { $settings = array_merge($settings, $settings[$repositoryUrl][$key]); } return $settings; }
/** * @param string $key * @throws \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException * @return void */ public function createAction($key) { $configuration = $this->presetRepository->findByIdentifier($key); $deployment = new Deployment(); $deployment->setConfiguration($configuration); $deployment->setClientIp($this->request->getHttpRequest()->getClientIpAddress()); $this->deploymentRepository->add($deployment); $this->addFlashMessage('Created a new deployment.'); $this->redirect('index', NULL, NULL, array('deployment' => $deployment)); }
/** * @param array * @return \Lightwerk\SurfCaptain\Domain\Model\Deployment */ protected function createFromConfiguration($configuration) { $repositoryUrl = $configuration['applications'][0]['options']['repositoryUrl']; $repository = $this->driverComposite->getRepository($repositoryUrl); $deployment = new Deployment(); $deployment->setRepositoryIdentifier($repository->getIdentifier()); $deployment->setRepositoryUrl($repositoryUrl); $deployment->setStaticConfiguration($configuration); // throw the clientIp away? $deployment->setClientIp(''); return $deployment; }
/** * @param string $key * @param string $type * @param string $context * @param string $branch * @return void */ public function createCommand($key, $type = 'TYPO3\\CMS\\Deploy', $context = 'Development', $branch = 'master') { $deployment = new Deployment(); $deployment->setClientIp('127.0.0.1'); try { $preset = $this->presetRepository->findByIdentifier($key); } catch (\Lightwerk\Surfcaptain\Exception $e) { $this->outputLine('cannot get preset'); $this->quit(); } $preset['applications'][0]['options']['branch'] = $branch; $preset['applications'][0]['options']['context'] = $context; $preset['applications'][0]['type'] = $type; if ($deployment->getRepository() !== NULL) { $this->deploymentRepository->add($deployment); $this->outputLine('SUCCESS: deployment created'); } else { $this->outputLine('ERROR: no repository'); } }
/** * @param SurfCaptainDeployment $surfCaptainDeployment * @param integer $status * @return void */ protected function setStatusAfterDeployment(SurfCaptainDeployment $surfCaptainDeployment, $status) { switch ($status) { case Deployment::STATUS_SUCCESS: $statusValue = SurfCaptainDeployment::STATUS_SUCCESS; break; case Deployment::STATUS_UNKNOWN: // Fall through // Fall through case Deployment::STATUS_FAILED: $statusValue = SurfCaptainDeployment::STATUS_FAILED; break; case Deployment::STATUS_CANCELLED: $statusValue = SurfCaptainDeployment::STATUS_CANCELLED; break; default: $statusValue = $status; } $surfCaptainDeployment->setStatus($statusValue); $this->writeSurfCaptainDeployment($surfCaptainDeployment); }