Home > database >  Force Jenkins to trigger separate builds for each branch event
Force Jenkins to trigger separate builds for each branch event

Time:08-08

I am using Bitbucket "Post Webhooks" to trigger Jenkins Builds on every push. When Jenkins is busy and commits are pushed multiple times within a short timeframe, it may occur, however, that Jenkins combines multiple branch events into 1 build.

Jenkins receives all branch events reliable and even shows all branch events responsible for a build within the build info. E.g:

Build #10 (Jul 27, 2022, 1:40:00 PM). Changes:

  • 1.0.1 (details / bitbucketweb)
  • 1.0.2-SNAPSHOT (details / bitbucketweb)

Events:

  • Branch event at 1:30:00 PM on Jul 27, 2022
  • Branch event at 1:35:00 PM on Jul 27, 2022

How may I prevent Jenkins from combining multiple events into 1 build and make him execute separate builds for each branch event instead?

CodePudding user response:

https://plugins.jenkins.io/generic-webhook-trigger/

You can solve this by making the one job parameterized. Resolve one of the parameters with something unique from the webhook. This will make each trigger unique and Jenkins will not batch the builds into one build.

https://github.com/jenkinsci/generic-webhook-trigger-plugin/issues/171

CodePudding user response:

I think you just have to set the quiet period to 0 on your pipelines.

Quiet Period: Quiet Period is the number of seconds that this Jenkins instance should be should wait before triggering a Job. The quiet period is important because suppose your job is auto-scheduled to run at some particular time, or the job can be triggered as soon they take place.

You can also look into this link for more information : https://www.jenkins.io/blog/2010/08/11/quiet-period-feature/

Hope this helps !

  • Related