Skip to content

Commit 67c8372

Browse files
authored
Add JobApi#getJob() (#1233)
1 parent 31e48eb commit 67c8372

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

gitlab4j-api/src/main/java/org/gitlab4j/api/JobApi.java

+13
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,19 @@ 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 = get(Response.Status.OK, null, "job");
304+
return (response.readEntity(Job.class));
305+
}
306+
294307
/**
295308
* Get single job in a project.
296309
*

0 commit comments

Comments
 (0)