Merge request pipelines link to wrong downstream Jenkins build.
Tools used/affected: Gitlab 10.5.4-ee with Jenkins 2.110
Summary
We have numerous developers who rely on the Pipelines view when following the status of their merge request. Our gitlab merge requests use webhooks to trigger jobs in Jenkins. The Pipeline used to link directly and consistently to the matching Jenkins job that was triggered - that job and that job only. With the 10.5.4-ee version, I think we caught up with the feature where the Jobs view was also added such that it shows any downstream jobs as well. At the same time, the pipelines started linking us to downstream jobs that provide very misleading info and cause confusion. In the provided example, the subsystem-wcsfe job triggered by the MR built successfully, caused the MR to be accepted, and the changes merged in. Yet the pipeline view shows the pipeline failed because it links to the downstream build of solution-wcsfe which did fail. And we have not enabled the feature "Only allow merge requests to be merged if the pipeline succeeds". Developers sometimes need a subsequent merge to address a downstream project, but we still want their upstream merge to go through if it builds.
Steps to reproduce
At least 2 git projects triggering Jenkins builds via the gitlab-plugin and webhooks. The first project gets a merge request that triggers the associated Jenkins job and succeeds. The 2nd Jenkins job is triggered as a downstream job and fails. The merge request Discussion view shows a successful build with the correct link. The pipelines view shows a failed pipeline and links to the downstream build.
Example Project
What is the current bug behavior?
Gitlab pipeline shows failed even though we're not relying on downstream jobs to succeed, and even though the triggered job was successful. The pipeline also links to a downstream job (also in a way that seems semi non-deterministic in terms of which one it links to) rather than the triggered job.
What is the expected correct behavior?
Gitlab pipeline shows the correct status for and links to the correct, triggered job.
Relevant logs and/or screenshots
Output of checks
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)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)