/** * The ComputerSet class will give informations like * {@link ComputerSet#getBusyExecutors()} or the * {@link ComputerSet#getTotalExecutors()}. * * @return {@link ComputerSet} * @throws IOException in case of an error. */ public ComputerSet getComputerSet() throws IOException { return client.get("computer/?depth=2", ComputerSet.class); }
/** * This will give you back the {@link PluginManager}. * * @return {@link PluginManager} * @throws IOException in case of a failure. */ public PluginManager getPluginManager() throws IOException { return client.get("pluginManager/?depth=2", PluginManager.class); }
/** * * @return The information from Jenkins. In cases the build has never run * {@link #BUILD_HAS_NEVER_RUN} will be returned. * @throws IOException * in case of an error. */ public BuildWithDetails details() throws IOException { return client.get(url, BuildWithDetails.class); }
public Queue getQueue() throws IOException { // TODO: Check if using depth=1 is a good idea? return client.get("queue/?depth=1", Queue.class); }
/** * Sends the Quiet Down (Prepare for shutdown) message * * @throws IOException in case of an error. */ public void quietDown() throws IOException { try { client.get("/quietDown/"); } catch (org.apache.http.client.ClientProtocolException e) { LOGGER.error("quietDown()", e); } }
/** * Get the current status of the Jenkins end-point by pinging it. * * @return true if Jenkins is up and running, false otherwise */ public boolean isRunning() { try { client.get("/"); return true; } catch (IOException e) { LOGGER.debug("isRunning()", e); return false; } }
/** * @return The full console output of the build. The line separation is done by * {@code CR+LF}. * * @see streamConsoleOutput method for obtaining logs for running build * * @throws IOException in case of a failure. */ public String getConsoleOutputText() throws IOException { return client.get(getUrl() + "/logText/progressiveText"); }
/** * Get the description of an existing Label * * @param labelName name of the label. * @return {@link LabelWithDetails} * @throws IOException in case of an error. */ public LabelWithDetails getLabel(String labelName) throws IOException { return client.get("/label/" + EncodingUtils.encode(labelName), LabelWithDetails.class); }
/** * The full console output with HTML. * * @see streamConsoleOutput method for obtaining logs for running build * * @return The console output as HTML. * @throws IOException in case of an error. */ public String getConsoleOutputHtml() throws IOException { return client.get(getUrl() + "/logText/progressiveHtml"); }
/** * Get the xml description of an existing job. * * @param jobName name of the job. * @param folder {@link FolderJob} * @return the new job object * @throws IOException in case of an error. */ public String getJobXml(FolderJob folder, String jobName) throws IOException { return client.get(UrlUtils.toJobBaseUrl(folder, jobName) + "/config.xml"); }
public MavenJobWithDetails mavenDetails() throws IOException { return client.get(getUrl(), MavenJobWithDetails.class); } }
public JacocoCoverageReport getJacocoCodeCoverageReport() throws IOException { return client.get(this.getUrl() + "/jacoco/", JacocoCoverageReport.class); } }
/** * This is to get the information about run tests for a * non Maven job type. * @return {@link TestResult} * @throws IOException in case of an error. */ public TestResult getTestResult() throws IOException { return client.get(this.getUrl() + "/testReport/?depth=1", TestResult.class); }
public JacocoCoverageReport getJacocoCodeCoverageReport() throws IOException { return client.get(this.getUrl() + "/jacoco/", JacocoCoverageReport.class); } }
/** * This is to get the information about {@link TestReport} * for a Maven Job type. * @return {@link TestReport} * @throws IOException in case of an error. */ public TestReport getTestReport() throws IOException { return client.get(this.getUrl() + "/testReport/?depth=1", TestReport.class); }
public MavenModule getMavenModule() throws IOException { return client.get(this.getUrl() + "/mavenArtifacts/", MavenModule.class); }
public MavenJobWithDetails mavenDetails() throws IOException { return client.get(getUrl(), MavenJobWithDetails.class); } }
public ComputerWithDetails details() throws IOException { String name; if ("master".equals(displayName)) { name = "(master)"; } else { name = UrlEscapers.urlPathSegmentEscaper().escape(displayName); } // TODO: Check if depth=2 is a good idea or if it could be solved // better. ComputerWithDetails computerWithDetails = client.get("/computer/" + name + "/?depth=2", ComputerWithDetails.class); computerWithDetails.setClient(client); return computerWithDetails; }
public String Stop() throws HttpResponseException, IOException { try { return client.get(url + "stop"); } catch (IOException ex) { if (((HttpResponseException) ex).getStatusCode() == 405) { stopPost(); return ""; } } return ""; }
public MavenJobWithDetails getMavenJob(FolderJob folder, String jobName) throws IOException { try { MavenJobWithDetails job = client.get(UrlUtils.toJobBaseUrl(folder, jobName), MavenJobWithDetails.class); job.setClient(client); return job; } catch (HttpResponseException e) { LOGGER.debug("getMavenJob(jobName={}) status={}", jobName, e.getStatusCode()); if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { return null; } throw e; } }