Using the Gitlab API, I can get a list of Jobs for a specific pipeline, as documented here: https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-jobs. There is a scope
attribute for the request documented there which has the description
Scope of jobs to show. Either one of or an array of the following: created, pending, running, failed, success, canceled, skipped, waiting_for_resource, or manual. All jobs are returned if scope is not provided.
My understanding of this would be that if I include a scope in my request, I will only get jobs back which finished with that status (or any of them if given multiple). The example uses this command line, though: https://gitlab.example.com/api/v4/projects/1/pipelines/6/jobs?scope[]=pending&scope[]=running
. So, my expectation would be that only jobs are listed with status: "pending"
or status: "running"
, but the example response shows two results, both with "status": "failed"
. The corresponding pipelines have status: "pending"
, though – does the scope apply to the pipeline status actually? I noticed the same in the example right above (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs).
So, when I give a specific scope in my request, is it the case that I only get jobs with the respective status (and the documentation is wrong?) or do I only get jobs from pipelines with the respective status (and I misunderstood/overlooked something or the documentation could actually be more precise here)?