0

I want to know what is the jenkins workflow in the following scenario.

Scenario 1:

Let's say a build job takes 30 minutes to complete and in the meantime the developers submit commits 1, 2 and 3 in the 1st minute and then commits 4, 5 are submitted in the 15th minute. Will jenkins create 2 separate build jobs in the queue if the polling frequency for SCM change is 1 minute? Or will it combine all the 5 commits into a single build job?

Scenario 2:

Also, what will happen if the quiet period is set to 5 minutes with SCM polling frequency set to 1 minute, and the long running build job is running and in the meantime 5 commits come at 1st minute, 4th minute, 11th minute, 15th minute and 16th minute after the previous build job was initiated? Will it still add two build jobs to the queue? Or will it combine these 5 commits into a single build?

agr.cs
  • 3
  • 2

1 Answers1

0

If polling every minute, in scenario #1, Jenkins will start two separate jobs, one for commits 1, 2, and 3, and a second for commits 4 and 5.

For scenario #2, Jenkins will also create two jobs if the quiet period is 5 minutes, based on your example.

There are a few solutions that help address the problem of new and old builds running concurrently. One option is to use the Milestone Pipeline plugin to automatically abort multiple concurrent jobs running, once one of them has reached a milestone.

The second is that some SCM plugins, such as the GitHub plugin, support a build trigger Cancel build on update feature, that will automatically stop running jobs when a new job is triggered via an update.

A third option is to use a Groovy script that executes as part of the build, and detects running jobs for older commits and aborts them.

ck1
  • 5,243
  • 1
  • 21
  • 25
  • thanks a ton. A follow up question, if the pipeline isn't configured to run concurrently then in that case will there be a single build for all the 5 commits? – agr.cs Mar 25 '19 at 00:25
  • Yes, if concurrent builds are disabled, the first build must end before any subsequent builds are started. – ck1 Mar 25 '19 at 01:44