/** * Update the <code>description</code> of a Job. * * @param description The description which should be set. If you like to * set an empty description you should use * {@link #EMPTY_DESCRIPTION}. * @param crumbFlag <code>true</code> or <code>false</code>. * @throws IOException in case of errors. */ public void updateDescription(String description, boolean crumbFlag) throws IOException { Objects.requireNonNull(description, "description is not allowed to be null."); ImmutableMap<String, String> params = ImmutableMap.of("description", description); client.post_form(this.getUrl() + "/submitDescription?", params, crumbFlag); }
public Job getJob(String jobName) { Job job = null; try { JobWithDetails jobWithDetails = getServer().getJob(jobName); if(jobWithDetails != null && jobWithDetails.getUrl() != null) { job = new Job(jobName, jobWithDetails.getUrl()); } } catch (IOException e) { LOGGER.error("Unable to get job by name '" + jobName + "'. " + e.getMessage(), e); } return job; }
public List<JenkinsJobBuildParameter> getBuildParams(String jobName){ try{ String jobJson = jenkinsHttpClient.get(new URI(jenkins.getJob(jobName).getUrl()).getPath()); logger.debug("Complete jobJson: " + jobJson); return parseJsonGetBuildParams(jobJson); }catch (Exception e){ logger.error("Failed to get build parameters for job: " + jobName); e.printStackTrace(); throw new BentenJenkinsException(e.getMessage()); } }
private QueueReference stop(JobWithDetails job, Integer buildNumber) throws IOException { ExtractHeader location = (ExtractHeader) job.getClient().post(job.getUrl() + buildNumber + "/stop", null, ExtractHeader.class); return new QueueReference(location.getLocation()); }
private QueueReference terminate(JobWithDetails job, Integer buildNumber) throws IOException { ExtractHeader location = (ExtractHeader) job.getClient().post(job.getUrl() + buildNumber + "/term", null, ExtractHeader.class); return new QueueReference(location.getLocation()); }
slackFormatter.link(jobWithDetails.getUrl(),jobWithDetails.getDisplayName()).text(jobWithDetails.getDescription()).newline().newline();