Add /jobs, /pipelines endpoint, return all jobs, pipelines
What does this MR do?
Hello
adds an admin
only endpoint to the api /v4/jobs
/v4/pipelines
returns all jobs in the given scope.
same as /admin/jobs
, /admin/pipelines
- prev. we needed to query all projects for all jobs/pipelines, to display an overall status on one of our internal tools.
that resulted in (NUMBER_OF_PROJECTS*NUMBER_OF_PAGES)
rest requests.
with this new endpoint we can fetch an "overall status in just one call.
if this MR gets accepted i am going to add it to narkoz/gitlab
(which is the gem we are using to talk to gitlab)
if the general OK to this, is given, i am more than happy to add tests/docs and all the stuff.
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/36423
Test
export USER_TOKEN="XXXX"
export ADMIN_TOKEN="XXX"
curl -H "PRIVATE-TOKEN: $USER_TOKEN" localhost/api/v4/jobs # 403
curl -H "PRIVATE-TOKEN: $ADMIN_TOKEN" localhost/api/v4/jobs # 200
curl -H "PRIVATE-TOKEN: $ADMIN_TOKEN" localhost/api/v4/jobs?scope=running # 200
curl -H "PRIVATE-TOKEN: $USER_TOKEN" localhost/api/v4/pipelines # 403
curl -H "PRIVATE-TOKEN: $ADMIN_TOKEN" localhost/api/v4/pipelines # 200
curl -H "PRIVATE-TOKEN: $ADMIN_TOKEN" localhost/api/v4/pipelines?scope=running # 200