Merge request can have `head_pipeline` instead of or along with `pipeline`
Summary
According to the sample result in GitLab API, merge request can have a pipeline
field. In some cases, the merge request also has an undocumented head_pipeline
that does not match the pipeline
. And the pipeline
may not match the pipeline in the MR as displayed by the UI. It can be null or refer to a different pipeline (seen this case only once, the first time I tried to recreate this issue on https://gitlab.com/). The only time when the GitLab API shows a head_pipeline
in an MR is when listing merge requests related to issue.
Steps to reproduce
- Create an MR.
- Post first commit pending status on a sha:
/statuses/<sha>?ref=<branch>&name=name1&target_url=<targetUrl>&state=pending&pipeline_id=-1
. - Get the sha commit:
/repository/commits/<sha>
and extract pipeline 1last_pipeline.id
. - Post second commit pending status on a sha:
/statuses/<sha>?ref=<branch>&name=name2&target_url=<targetUrl>&state=pending&pipeline_id=-1
. - Get the sha commit:
/repository/commits/<sha>
and extract pipeline 2last_pipeline.id
. - Post commit success status on first pipeline:
/statuses/<sha>?ref=<branch>&name=name1&target_url=<targetUrl>&state=success&pipeline_id=<pipeline1>
. - Post commit failed status on second pipeline:
/statuses/<sha>?ref=<branch>&name=name1&target_url=<targetUrl>&state=failed&pipeline_id=<pipeline2>
.
Example Project
https://gitlab.com/GeorgesZ473/Issue356086
What is the current bug behavior?
With GitLab Enterprise Edition 13.12.10-ee, the pipeline
field is null, while the head_pipeline
field seems to correspond with the correct pipeline as display in the MR UI.
With https://gitlab.com/, the pipeline
field seems to correspond to the pipeline of the commit, while the head_pipeline
seems to correspond to the pipeline of the MR.
What is the expected correct behavior?
The MR should have a pipeline
field that match the pipeline displayed in the MR and should not have a head_pipeline
field.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com.
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)