Add admin jobs API route
Description
It would be nice if the data available in the jobs tab of the admin interface was also available by the API. e.g. /api/v4/jobs?scope=running
would return all running jobs across all projects.
Proposal
Create an API endpoint at /api/v4/jobs
- it would have the same specification as the project specific endpoint but would instead run against all jobs across all projects. There are no further API endpoints required, as any more specificity requires a job ID, and can stick with the standard /projects/:id/jobs
endpoint.
The only difficulty I can see is that a project_id
field is not included by default when fetching a job entity (as per the project specific endpoint) as this is already assumed to be known - I'm not sure how easy this is to change but would be nice if a project id or entity could also be included in the overall endpoint.
Links / references
I'm assuming most work required would be in https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/api/jobs.rb
Use cases
This endpoint would be very useful for creating a publicly visible shared runner dashboard that shows how much load an organisation's shared runners are currently under/how many builds are pending etc so users can see how long their builds might take if they're currently pending.