示例#1
0
 /**
  * @return Jenkins_Job[]
  */
 public function getJobs()
 {
     $jobs = array();
     foreach ($this->view->jobs as $job) {
         $jobs[] = $this->jenkins->getJob($job->name);
     }
     return $jobs;
 }
示例#2
0
文件: index.php 项目: Warkot/Bolt
 public function updateSandboxMercuryDev()
 {
     echo "# Updating sandbox-mercurydev started\n";
     $jenkins = new Jenkins();
     $jobUrl = $jenkins->getJobUrl(DEV_SYNC_JOB);
     echo "# Waiting for the job to be available\n";
     while (!$jenkins->isJobAvailable(DEV_SYNC_JOB)) {
         sleep(1);
     }
     $jobQueueUrl = $jenkins->getQueueUrl($jobUrl);
     echo "# Waiting for the job to be built\n";
     do {
         sleep(1);
         $jobBuildUrl = $jenkins->getBuildUrl($jobQueueUrl);
     } while (empty($jobBuildUrl));
     echo "# Waiting for the job to finish\n";
     do {
         sleep(1);
         $jobStatus = $jenkins->getBuildStatus($jobBuildUrl);
     } while (empty($jobStatus));
     echo "# Job done. Setting flag and exiting. Bye!\n";
     if (!empty($jobStatus) && $jobStatus !== 'SUCCESS') {
         $this->setErrorFlag();
     }
 }
示例#3
0
 /**
  * @param Jenkins $jenkins
  * @param array   $parameters
  */
 public function launch(Jenkins $jenkins, $parameters = array())
 {
     $jenkins->launchJob($this->getJobName(), array_merge($parameters, array(JenkinsRunPeer::JENKINS_BRANCH_PARAMETER_NAME => $this->getGitBranch())));
 }
 /**
  * @param Jenkins $jenkins
  * @return array
  */
 private function getViews(Jenkins $jenkins)
 {
     $views = array();
     foreach ($jenkins->getViews() as $view) {
         /** @var Jenkins_View $view */
         $views[] = $view->getName();
     }
     return $views;
 }
示例#5
0
 /**
  * @return string
  *
  * @throws RuntimeException
  */
 public function retrieveXmlConfigAsString()
 {
     return $this->jenkins->retrieveXmlConfigAsString($this->getName());
 }