/** * Trigger a build without parameters * * @return {@link QueueReference} for further analysis of the queued build. * @throws IOException in case of an error. */ public QueueReference build() throws IOException { ExtractHeader location = client.post(url + "build", null, ExtractHeader.class, false); return new QueueReference(location.getLocation()); }
private boolean checkReference(QueueReference reference) { return reference != null && !StringUtils.isEmpty(reference.getQueueItemUrlPart()); }
/** * Trigger a build with crumbFlag. * * @param crumbFlag true or false. * @return {@link QueueReference} for further analysis of the queued build. * @throws IOException in case of an error. */ public QueueReference build(boolean crumbFlag) throws IOException { ExtractHeader location = client.post(url + "build", null, ExtractHeader.class, crumbFlag); return new QueueReference(location.getLocation()); }
public QueueItem getQueueItem(QueueReference ref) throws IOException { try { String url = ref.getQueueItemUrlPart(); // "/queue/item/" + id QueueItem queueItem = client.get(url, QueueItem.class); queueItem.setClient(client); return queueItem; } catch (HttpResponseException e) { if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { return null; } throw e; } }
/** * Trigger a parameterized build with file parameters and crumbFlag * * @param params the job parameters * @param fileParams the job file parameters * @param crumbFlag determines whether crumb flag is used * @return {@link QueueReference} for further analysis of the queued build. * @throws IOException in case of an error. */ public QueueReference build(Map<String, String> params, Map<String, File> fileParams, boolean crumbFlag) throws IOException { String qs = join(Collections2.transform(params.entrySet(), new MapEntryToQueryStringPair()), "&"); ExtractHeader location = client.post(url + "buildWithParameters?" + qs,null, ExtractHeader.class, fileParams, crumbFlag); return new QueueReference(location.getLocation()); }
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()); }