Пример #1
0
 /**
  * @inheritDoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $repo = $input->getArgument('repo');
     if (!$repo) {
         while (!($repo = $this->getRepoName($input, $output))) {
         }
     }
     $buildId = $input->getArgument('id');
     if (!$buildId) {
         while (!($buildId = $this->getBuildId($input, $output))) {
         }
     }
     $this->deployService->deploy($repo, $buildId, $output);
 }
Пример #2
0
 /**
  * @inheritDoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $repo = $input->getArgument('repo');
     if (!$repo) {
         while (!($repo = $this->getRepoName($input, $output))) {
         }
     }
     $branch = $input->getArgument('branch');
     if (!$branch) {
         while (!($branch = $this->getBuildType($input, $output))) {
         }
     }
     $this->firstRun($output);
     $buildResult = $this->jenkins->buildRepo($repo, $branch);
     $deployResult = new DeployResult();
     $buildSuccess = $buildResult->getResult() == BuildResult::SUCCESS;
     if ($buildSuccess) {
         $deployResult = $this->deployService->deploy($repo, $buildResult->getBuildId(), $output);
     } else {
         $output->writeln("<error>Build failed. Skipping deployment.</error>");
     }
     if (!$buildSuccess) {
         BuildCache::clear($repo, $branch);
     }
     $deploySuccess = $deployResult->getDeployResult() == DeployResult::SUCCESS;
     if ($buildSuccess && $deploySuccess) {
         BuildCache::clear($repo, $branch);
         return 0;
     }
     return 1;
 }