/** * @return Jenkins_Job[] */ public function getJobs() { $jobs = array(); foreach ($this->view->jobs as $job) { $jobs[] = $this->jenkins->getJob($job->name); } return $jobs; }
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(); } }
/** * @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; }
/** * @return string * * @throws RuntimeException */ public function retrieveXmlConfigAsString() { return $this->jenkins->retrieveXmlConfigAsString($this->getName()); }