Not all jobs are returned from Jobs API
Summary
When requesting the Jobs API for all jobs of a pipeline, one may expect to get all jobs of a pipeline. This does not happen in my case. When during pipeline one job gets cancelled by user, all remaining jobs also get cancelled. When requesting for all jobs of a pipeline the response holds a collection of some jobs that succeeded and some that was cancelled. Thats fine now However, when a user retires the cancelled job and it passes, gitlab creates subsequent jobs and starts them. When a request to Jobs API is performed after all remaining jobs pass, the response is the same as in previous case - a collection of some succeeded and some cancelled jobs
Steps to reproduce
- Create a pipeline with many steps
- Run the pipeline and cancel any job
- Send a request to
https://gitlab_instance/api/v4/projects/:projectid/pipelines/:pipelineid/jobs
- Retry the previously cancelled job
- Wait until the pipeline finishes
- Send a request to
https://gitlab_instance/api/v4/projects/:projectid/pipelines/:pipelineid/jobs
Response from steps 3 and 6 are the same, but response from step 6 should contain all jobs that passed
What is the current bug behavior?
In one specific case, the Jobs API response misses some jobs that belong to the pipeline
What is the expected correct behavior?
Jobs API should respond with all jobs created by the pipeline
Relevant logs and/or screenshots
In the example here the cancelled and retried job is 'build-webserver'.
$ curl -sH "PRIVATE-TOKEN: my_token" 'https://my_gitlab_instance/api/v4/projects/project_id/pipelines/pipeline_id/jobs' | jq '.[] | {status, name}'
{
"status": "canceled",
"name": "build_webserver"
}
{
"status": "canceled",
"name": "unit_tests"
}
{
"status": "canceled",
"name": "functests"
}
(...)
{
"status": "success",
"name": "build_webserver"
}
In the Jobs API response only the 'build_webserver' job is shown twice, once with status cancelled and once with status success. Any other job is shown second time, all of them have status 'cancelled'
Results of GitLab environment info
I'm not the admin of our gitlab instance and cannot provide any application on environment info