コード例 #1
0
 /**
  * 
  */
 public function preExecute()
 {
     parent::preExecute();
     $userId = $this->getUser()->getUserId();
     $jenkins = $this->getJenkins();
     if ($jenkins->isAvailable()) {
         JenkinsRunPeer::fillEmptyJobBuildNumber($jenkins, $userId);
     }
 }
コード例 #2
0
 /**
  * @return void
  */
 public function preExecute()
 {
     if (null === $this->getJenkinsUrl()) {
         $this->getUser()->setFlash('error', "There is no url for your Jenkins");
         $this->redirect('user/configure');
     }
     $jenkinsFactory = new Jenkins_Factory();
     $jenkins = $jenkinsFactory->build($this->getJenkinsUrl());
     $this->setJenkins($jenkins);
     //à chaque hit on met à jour
     if ($jenkins->isAvailable()) {
         JenkinsRunPeer::fillEmptyJobBuildNumber($jenkins, $this->getUser()->getUserId());
     } else {
         $this->getUser()->setFlash('error', 'Jenkins is not started, or your configuration is incorrect.');
     }
     $this->setVar('jenkins', $jenkins);
 }
コード例 #3
0
 /**
  * @param sfWebRequest $request
  *
  */
 public function execute($request)
 {
     $branchName = $request->getParameter('git_branch_slug');
     $userId = $this->getUser()->getUserId();
     $groupRun = JenkinsGroupRunPeer::retrieveBySfGuardUserIdAndGitBranchSlug($userId, $branchName);
     $this->forward404If(null === $groupRun, sprintf('Can\'t retrieve JenkinsGroupRun with branch name %s and user id %s', $branchName, $userId));
     $delayed = $request->getParameter('delayed') == 1;
     $onlyUnstabled = $request->getParameter('unstabled') == 1;
     $groupRun->rebuild($this->getJenkins(), $delayed, $onlyUnstabled);
     JenkinsRunPeer::fillEmptyJobBuildNumber($this->getJenkins(), $this->getUser()->getUserId());
     $message = sprintf('The build [%s] has been relaunched', $groupRun->getLabel());
     if ($delayed) {
         $message = sprintf('The jobs of build [%s] have been added to the delayed list', $groupRun->getLabel());
     } elseif ($onlyUnstabled) {
         $message = sprintf('All the jobs of build [%s] have been added to the delayed list', $groupRun->getLabel());
     }
     $this->getUser()->setFlash('info', $message);
     $this->redirect($this->generateUrl('branch_view', $groupRun));
 }
コード例 #4
0
ファイル: JenkinsRun.php プロジェクト: xfifix/Jenkins-Khan
 public function computeJobBuildNumber(Jenkins $jenkins, myUser $user)
 {
     if (null !== $this->getJobBuildNumber()) {
         return;
     }
     $criteria = new Criteria();
     $criteria->add(JenkinsRunPeer::ID, $this->getId());
     JenkinsRunPeer::fillEmptyJobBuildNumber($jenkins, $user->getUsername(), $criteria);
 }