Thank you for your opinions. Let me show you my pipeline script and the above scenario in details.
TL;DR
- Jenkins Configuration: # of executors = 1
- I have not configured any node options. I mean only Built-in Node is used.
- Pipeline Definition: Pipeline script (as below)
pipeline {
agent any
options {
disableConcurrentBuilds()
timeout(time: 2, unit: 'HOURS')
}
triggers {
pollSCM('H/15 * * * *') // polling every 15 minute
}
tools {
jdk 'oraclejdk-17.0.12'
git 'Default'
}
stages {
stage('Checkout') {
deleteDir()
checkout([$class: 'GitSCM',
branches: [[name: "main"]],
extensions: [[
[$class: 'CloneOption', honorRefspec: true, noTags: true, reference: '', shallow: false, timeout:60],
[$class: 'LocalBranch', localBranch: '**'], ... ]])
}
stage('Build') { ... }
}
post { ... }
}
- Letâs say there are TWO identical itemsâitemA and itemB, each of which has different remote URLs.
- The build process takes 1-hour
- The scenario with timeline what I addressed:
PART I. The first build trigger (ItemA #5: RUNNING)
- [08:55] A developer push some commits to a remote repository where ItemA is polling.
- [09:00] ItemA checks the remote repository, finds changes, triggers its build.
- Git Polling Log:
- Started on Aug 11, 2025, 09:00:00 AM
- [poll] Last Built Revision: Revision cc38a540.. (origin/main)
- âŚ
- Polling for changes in
- > git rev-parse origin/main^{commit} # timeout=10
- > git log --full-history --no-abbrev --format=raw -M -m --raw
- cc38a540..dac11c17
- Done. Took 2.1 sec
- Changes Found
- [09:00] ItemA build starts (letâs say #5)
- Console Output:
- Started by an SCM change
- [Pipeline] Start of Pipeline
- [Pipeline] node
- Running on Jenkins..
- (This build will have finished in 1-hour)
[Jenkins Dashboard]
Build Queue (0)
(No builds in the queue.)
Build Executor Status
(1 of 1 executor busy)
-ItemA #5
PART II. The second build trigger (ItemB #2: RUNNING)
- [09:05] A developer push some commits to a remote repository where ItemB is polling.
- [09:15] ItemB checks the remote repository, finds changes, triggers its build.
- Git Polling Log:
- Started on Aug 11, 2025, 09:15:00 AM
- [poll] Last Built Revision: Revision 68932d5d.. (origin/main)
- âŚ
- Polling for changes in
- > git rev-parse origin/main^{commit} # timeout=10
- > git log --full-history --no-abbrev --format=raw -M -m --raw
- 68932d5d..dc0ec631
- Done. Took 2.1 sec
- Changes Found
- [09:15] ItemB build starts (letâs say #2)
- Console Output:
- Started by an SCM change
- [Pipeline] Start of Pipeline
- [Pipeline] node
- Still waiting to schedule task
- Waiting for next available executor
[Jenkins Dashboard]
Build Queue (1)
(part of ItemB #2)
Build Executor Status
(1 of 1 executor busy)
-ItemA #5
[ItemB Dashboard]
Builds
( â ) #2 AM 09:15 -> the pop-up says 'In progress'
PART III. The third build trigger (ItemB #3: PENDING)
- [09:30] Once again ItemB checks the remote repository because the next polling schedule arrives. So far, so good. However, changes are found although there are no changes in the remote repository. Finally, it triggers a build.
- Git Polling Log:
- Started on Aug 11, 2025, 09:30:00 AM
- [poll] Last Built Revision: Revision 68932d5d.. (origin/main)
- âŚ
- Polling for changes in
- > git rev-parse origin/main^{commit} # timeout=10
- > git log --full-history --no-abbrev --format=raw -M -m --raw
- 68932d5d..dc0ec631
- Done. Took 2.1 sec
- Changes Found
- [09:30] ItemB build becomes pending (letâs say #3)
- This job has no console output yet.
- This job will start sequentially, but the build is very likely duplicated with the build of ItemB #2.
[Jenkins Dashboard]
Build Queue (2)
(ItemB)
(part of ItemB #2)
Build Executor Status
(1 of 1 executor busy)
-ItemA #5
[ItemB Dashboard]
Builds
(...) #3 -> pending-Build #2 is already in progress
( â ) #2 AM 09:15 -> the pop-up says 'In progress'
Discussion
There is something that strikes me as odd. Only Pipeline style has such trigger in the Part III. At 09:30, the job of ItemA #5 is still running, which was triggered in the Part I. The job of ItemB #2 is not only queued, it hasnât built yet, but the pop-up says âIn progressâ as mentioned in the Part II. Finally, the job of ItemB #3 is triggered because of changes, which are the same as those in ItemB #2.
The job of ItemB #3 will start when the previous two jobs are done, which are IteamA #5 and ItemB #2 in sequence. However, since ItemB #2 will build the latest project, this job, ItemB #3, will be âduplicatedâ. That is why I say âredundantâ.
Whatâs interesting about this redundant build, so called âpendingâ, is that it prevents another job in the current item from being queued after polling. When Freestyle was used in the above scenario, ItemB #2 in the Part II was immediately in a pending state unlike Pipeline and ItemB #3 would not happen. That is why I got to think about thread types, heavy-weight or light-weight, to try to understand how Jenkins handles a polling between Freestyle and Pipeline.
Thank you.