I have setup Gitlab Jenkins integration with 3 webhooks for 3 jenkins jobs along with "Publish build status to Gitlab" in post build action. Facing issue as explained below.
Setup:
Jenkins version V2.152, Gitlab version 11.7.0-ee, 3 Webhooks for 3 jenkins jobs
Jenkins freestyle project
Jenkins Git: Branch Specifier is origin/${gitlabSourceBranch}
Jenkins Trigger: Selected "Build when a change is pushed to GitLab" with Push Events, Opened Merge Request Events, Rebuild open Merge Requests on push to source branch and comment
Issue:
Pipeline stays in pending state forever: If no jenkins job is running and a branch is updated, the single pipeline for a commit is created which tracks all the 3 jenkins jobs. But, if any of the jenkins job is running and branch is updated then three separate pipelines are created for same commit ID, one for one jenkins job. In this case, as soon as any of the tree jenkins project starts running, only latest pipeline change its state to running which now starts tracking all 3 jenkins jobs, and the other 2 pipelines stay in pending state forever, they never run nor get cancelled. I have also selected Auto-cancel redundant, pending pipelines feature but it is on working.
Expected:
In Gitlab, it should always create a seperate pipeline for each job and track them OR should create a single pipeline for each commit and track all the jobs.
How can I avoid having pending pipelines that never change its status? Or how can I make Auto-cancel redundant, pending pipelines feature run?