Skip to content

Commit 386a6fc

Browse files
committed
Add getJobLog(..) to JobApi
1 parent a8f540f commit 386a6fc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,22 @@ public Optional<Job> getOptionalJob(Object projectIdOrPath, Long jobId) {
357357
}
358358
}
359359

360+
/**
361+
* Get a log (trace) of a specific job of a project.
362+
*
363+
* <pre><code>GitLab Endpoint: GET /projects/:id/jobs/:job_id/trace</code></pre>
364+
*
365+
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path to get the job for
366+
* @param jobId the job ID to get
367+
* @return a single job for the specified project ID
368+
* @throws GitLabApiException if any exception occurs during execution
369+
*/
370+
public String getJobLog(Object projectIdOrPath, Long jobId) throws GitLabApiException {
371+
Response response =
372+
get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "trace");
373+
return (response.readEntity(String.class));
374+
}
375+
360376
/**
361377
* Download the artifacts file from the given reference name and job provided the job finished successfully.
362378
* The file will be saved to the specified directory. If the file already exists in the directory it will

0 commit comments

Comments
 (0)