0
0
Jenkinsdevops~10 mins

Poll SCM configuration in Jenkins - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Poll SCM configuration
Start Jenkins Job
Check Poll SCM Schedule
Is current time matching schedule?
NoWait until next check
Yes
Poll SCM for changes
Are there changes?
NoDo not build, wait for next poll
Yes
Trigger Build
End Job Cycle
Jenkins checks the SCM at scheduled times; if changes are found, it triggers a build, otherwise waits for the next poll.
Execution Sample
Jenkins
pollSCM('H/15 * * * *') {
  scm
}

// Jenkins polls SCM every 15 minutes
This Jenkins pipeline snippet configures polling SCM every 15 minutes to detect changes and trigger builds.
Process Table
StepTimePoll SCM Triggered?SCM Changes Detected?Action Taken
100:00YesNoNo build triggered, wait for next poll
200:15YesYesBuild triggered
300:30YesNoNo build triggered, wait for next poll
400:45YesYesBuild triggered
501:00YesNoNo build triggered, wait for next poll
601:15YesNoNo build triggered, wait for next poll
💡 Polling continues indefinitely at scheduled intervals; builds only triggered when SCM changes are detected.
Status Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6
Time00:0000:1500:3000:4501:0001:1501:30
Poll SCM TriggeredYesYesYesYesYesYesYes
SCM Changes DetectedNoYesNoYesNoNoYes
Build TriggeredNoYesNoYesNoNoYes
Key Moments - 3 Insights
Why doesn't Jenkins trigger a build every time it polls SCM?
Jenkins triggers a build only if SCM changes are detected during the poll, as shown in execution_table rows 1 and 3 where polling occurs but no changes are found, so no build is triggered.
What does the schedule 'H/15 * * * *' mean in Poll SCM?
It means Jenkins polls SCM every 15 minutes at a hashed time to distribute load, as reflected in the execution_table times (00:00, 00:15, 00:30, etc.).
Does Jenkins build immediately after a commit to SCM?
No, Jenkins builds only at the next scheduled poll time after detecting changes, not instantly on commit, as seen in the delay between SCM changes and build triggers in the table.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which time is a build triggered after SCM changes are detected?
A00:15
B00:30
C01:00
D01:15
💡 Hint
Check the 'Build Triggered' column for 'Yes' and match with 'SCM Changes Detected' at the same step.
At which step does Jenkins poll SCM but no changes are detected?
AStep 2
BStep 3
CStep 4
DStep 6
💡 Hint
Look at 'SCM Changes Detected?' column for 'No' while 'Poll SCM Triggered?' is 'Yes'.
If the polling schedule changed to every 30 minutes, how would the execution table change?
ASCM changes would be detected more frequently
BBuilds would trigger twice as often
CPolling steps would occur every 30 minutes instead of 15
DBuilds would trigger immediately on commit
💡 Hint
Polling frequency controls how often Jenkins checks SCM, not how often changes occur or builds trigger.
Concept Snapshot
Poll SCM in Jenkins:
- Configure with cron-like syntax (e.g., 'H/15 * * * *')
- Jenkins checks SCM at scheduled times
- If changes detected, triggers build
- If no changes, waits for next poll
- Polling spreads load using 'H' (hash) for timing
Full Transcript
Poll SCM configuration in Jenkins means setting a schedule for Jenkins to check the source code repository for changes. Jenkins uses a cron-like syntax to decide when to poll. At each scheduled time, Jenkins checks if there are any new commits or changes in the SCM. If changes are found, Jenkins triggers a build to update the project. If no changes are found, Jenkins waits until the next scheduled poll. This process repeats indefinitely, ensuring builds only happen when needed, saving resources and time.