Esempio n. 1
0
 /**
  * @param BuildFinishedEvent $event
  */
 public function onBuildFinished(BuildFinishedEvent $event)
 {
     $build = $event->getBuild();
     if (!$build->isRunning()) {
         return;
     }
     if (strlen($build->getHost()) === 0) {
         if ($build->hasForcedDomain()) {
             $build->setHost($build->getDomain());
         } else {
             $build->setHost(sprintf($this->buildHostMask, $build->getDomain()));
         }
     }
     $this->logger->info('configuring build routing', ['build' => $build->getId(), 'host' => $build->getHost()]);
     $container_url = 'http://' . $this->builderIp . ':' . $build->getPort();
     $this->logger->info('configuring build instance routing', ['build' => $build->getId(), 'backend' => $container_url]);
     $redis = $this->redis;
     $redis->multi();
     $redis->del('frontend:' . $build->getHost());
     $redis->rpush('frontend:' . $build->getHost(), $build->getImageName(), $container_url);
     $urls = $build->getOption('urls', []);
     if (count($urls) > 0) {
         $this->logger->info('adding custom build URLs', ['build' => $build->getId(), 'domains' => $urls]);
         foreach ($urls as $domain) {
             $host = $domain . '.' . $build->getHost();
             $redis->del('frontend:' . $host);
             $redis->rpush('frontend:' . $host, $build->getImageName(), $container_url);
         }
     }
     $redis->exec();
 }
 /**
  * @param App\CoreBundle\Event\BuildFinishedEvent
  */
 public function onBuildFinished(BuildFinishedEvent $event)
 {
     $build = $event->getBuild();
     /** @todo write a producer that accepts Message objects */
     $this->logger->info('sending build.finished message', ['build' => $build->getId()]);
     $message = $this->factory->createBuildFinished($build);
     $this->producer->publish((string) $message);
 }
 /**
  * @param App\CoreBundle\Event\BuildFinishedEvent
  */
 public function onBuildFinished(BuildFinishedEvent $event)
 {
     $build = $event->getBuild();
     $logger = $this->logger;
     if (!$build->isRunning()) {
         return;
     }
     $this->quota->enforce($build->getUsers()->first());
 }
 public function onBuildFinished(BuildFinishedEvent $event)
 {
     $build = $event->getBuild();
     if (!$build->isRunning()) {
         return;
     }
     $previousBuild = $this->repository->findPreviousBuild($build);
     if (!$previousBuild) {
         return;
     }
     $this->logger->info('detected previous build', ['previous_build_id' => $previousBuild->getId()]);
     $this->scheduler->stop($previousBuild, Build::STATUS_OBSOLETE);
 }
Esempio n. 5
0
 public function onBuildFinished(BuildFinishedEvent $event)
 {
     if (!$this->enabled) {
         return;
     }
     $build = $event->getBuild();
     if (!$build->isRunning()) {
         return;
     }
     $project = $build->getProject();
     $provider = $this->providerFactory->getProvider($project);
     $provider->sendPullRequestComment($project, $build);
 }
 /**
  * @param App\CoreBundle\Event\BuildFinishedEvent
  */
 public function onBuildFinished(BuildFinishedEvent $event)
 {
     $build = $event->getBuild();
     try {
         $this->logger->info('stopping stopwatch for build #' . $build->getId());
         $event = $this->stopwatch->stop($build->getChannel());
         $build->setEndTime(new DateTime());
         $build->setDuration($event->getDuration());
         $build->setMemoryUsage($event->getMemory());
     } catch (LogicException $e) {
         $this->logger->info('stopwatch was not started');
     }
 }
 public function onBuildFinished(BuildFinishedEvent $event)
 {
     if (!$this->enabled) {
         return;
     }
     $build = $event->getBuild();
     if (!$build->isRunning()) {
         $this->logger->info('skipping commit status for non-running build');
         return;
     }
     if (strlen($build->getHash()) === 0) {
         $this->logger->info('skipping commit status because of empty commit hash');
         return;
     }
     $project = $build->getProject();
     if (null === $project) {
         $this->logger->info('could not find a project for build', ['build_id' => $build->getId()]);
         return;
     }
     $provider = $this->providerFactory->getProvider($project);
     $provider->setCommitStatus($project, $build, 'success');
 }