GitLab API: pipeline not returning all jobs

Viewed 859

I'm using the GitLab api, to list out the jobs in a pipeline. It's always been fine in the past, but I've added a couple of extra items to the flow and now it doesn't return all of the jobs:

$ curl --globoff -sSH "$CURL_HEADER" https://.../api/v4/projects/$CI_PROJECT_ID/pipelines/$PIPEID/jobs?scope[]=success | jq --raw-output '.[] | "\(.id)"' | wc -l
20

The jobs that are missing aren't retries (as noted here).

I can see the missing jobids in the web interface.

Is there a maximum of 20 jobs via this method?

1 Answers

So turns out this API response is paginated, there's no indication in docs for this item.

There is a general item describing this here, but it doesn't give a list of routes it is related to. If it did it would probably show up in a search far easier.

All I needed to do was append &per_page=100 (qq-ing for the & for my use case). Alternatively you can check the return header for the X-Next-Page value and then append &page=X to get the subsequent pages...

Related page variables are:

x-next-page: 2
x-page: 1
x-per-page: 20
x-prev-page: 
x-total: 23
x-total-pages: 2
Related