Skip to content

Commit b91e6df

Browse files
committed
Add getJob()
Fixes gitlab4j#1231
1 parent 98f686b commit b91e6df

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java

+14
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,20 @@ public Stream<Job> getJobsStream(Object projectIdOrPath, long pipelineId, Boolea
291291
return (getJobsForPipeline(projectIdOrPath, pipelineId, getDefaultPerPage(), includeRetried).stream());
292292
}
293293

294+
/**
295+
* Retrieve the job corresponding to the <code>$CI_JOB_TOKEN</code> environment variable (Using a {@link org.gitlab4j.models.Constants.TokenType#JOB_TOKEN} authentication).
296+
*
297+
* <pre><code>GitLab Endpoint: GET /job</code></pre>
298+
*
299+
* @return a single job
300+
* @throws GitLabApiException if any exception occurs during execution
301+
*/
302+
public Job getJob() throws GitLabApiException {
303+
Response response =
304+
get(Response.Status.OK, null, "job");
305+
return (response.readEntity(Job.class));
306+
}
307+
294308
/**
295309
* Get single job in a project.
296310
*

0 commit comments

Comments
 (0)