diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java index 4271e2ddf..5b4e30baf 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java @@ -291,6 +291,19 @@ public Stream getJobsStream(Object projectIdOrPath, long pipelineId, Boolea return (getJobsForPipeline(projectIdOrPath, pipelineId, getDefaultPerPage(), includeRetried).stream()); } + /** + * Retrieve the job corresponding to the $CI_JOB_TOKEN environment variable (Using a {@link org.gitlab4j.models.Constants.TokenType#JOB_TOKEN} authentication). + * + *
GitLab Endpoint: GET /job
+ * + * @return a single job + * @throws GitLabApiException if any exception occurs during execution + */ + public Job getJob() throws GitLabApiException { + Response response = get(Response.Status.OK, null, "job"); + return (response.readEntity(Job.class)); + } + /** * Get single job in a project. *