Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add JobApi#getJob() #1233

Merged
merged 2 commits into from
Mar 5, 2025
Merged

Add JobApi#getJob() #1233

merged 2 commits into from
Mar 5, 2025

Conversation

jmini
Copy link
Collaborator

@jmini jmini commented Mar 5, 2025

jmini added a commit to jmini/jbang-ci-test that referenced this pull request Mar 5, 2025
@jmini jmini merged commit 67c8372 into gitlab4j:main Mar 5, 2025
2 checks passed
* @throws GitLabApiException if any exception occurs during execution
*/
public Job getJob() throws GitLabApiException {
Response response = get(Response.Status.OK, null, "job");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend checking that a JOB_TOKEN was set in gitlabApi and throwing a meaningful exception if not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added with #1236

*
* <pre><code>GitLab Endpoint: GET /job</code></pre>
*
* @return a single job
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend adding more explanation that this will only work while the CI_JOB_TOKEN is valid (while the CI job is running) or similar.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1236

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support https://docs.gitlab.com/api/jobs/#get-job-tokens-job in JobApi
2 participants