2

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?

Toral
  • 551
  • 1
  • 5
  • 13

1 Answers1

0

Check if GitLab 14.6 (December 2021) can improve your webhook/jobs management:

Webhook triggered for pending jobs

Previously, using job event webhooks for CI/CD monitoring was challenging because it was difficult to track the number of pending jobs that may exist within a project.

Now the webhook triggers an event when a job state changes to pending, so you no longer need to implement workarounds or custom integrations to keep track of all job statuses.

See Documentation and Issue.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250