0
0
Jenkinsdevops~10 mins

Build triggers (poll SCM, webhook, timer) in Jenkins - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Build triggers (poll SCM, webhook, timer)
Start Jenkins Job Setup
Choose Build Trigger Type
Poll SCM
Trigger Condition Met?
Yes
Start Build Execution
Build Done
End
This flow shows how Jenkins waits for a trigger (poll SCM, webhook, or timer) to start a build, then runs the build and finishes.
Execution Sample
Jenkins
pipeline {
  triggers {
    pollSCM('H/5 * * * *')
    // or
    // githubPush()
    // or
    // cron('H 4/* 0 0 1-5')
  }
  stages {
    stage('Build') { steps { echo 'Building...' } }
  }
}
This Jenkins pipeline uses triggers: polling SCM every 5 minutes, or webhook, or timer cron to start the build.
Process Table
StepTrigger TypeTrigger ConditionCondition ResultAction Taken
1poll SCMSCM changed since last build?NoWait, no build started
2poll SCMSCM changed since last build?YesStart build
3BuildBuild runningN/ABuild executes steps
4WebhookWebhook received?NoWait, no build started
5WebhookWebhook received?YesStart build
6TimerCron time reached?NoWait, no build started
7TimerCron time reached?YesStart build
8BuildBuild runningN/ABuild executes steps
9EndBuild finishedN/AJob ends, waits for next trigger
💡 Execution stops after build finishes and waits for next trigger event.
Status Tracker
VariableStartAfter Step 2After Step 5After Step 7Final
SCM_Changedfalsetruetruetruetrue
Webhook_Receivedfalsefalsetruetruetrue
Cron_Timefalsefalsefalsetruetrue
Build_Runningfalsetruetruetruefalse
Key Moments - 3 Insights
Why does Jenkins not start a build immediately after polling SCM if no changes are detected?
Because the condition 'SCM changed since last build?' is false (see execution_table row 1), Jenkins waits and does not trigger the build.
How does Jenkins know when to start a build from a webhook?
Jenkins listens for an external webhook event; when it receives one (execution_table row 5), it triggers the build immediately.
What happens if multiple triggers are configured at the same time?
Jenkins evaluates each trigger independently; if any trigger condition is true (rows 2,5,7), it starts the build.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does Jenkins start a build due to SCM polling?
AStep 2
BStep 1
CStep 4
DStep 6
💡 Hint
Check the 'Action Taken' column for 'Start build' related to 'poll SCM' trigger.
According to the variable tracker, what is the value of Build_Running after step 7?
Afalse
Btrue
Cundefined
Dnull
💡 Hint
Look at the 'Build_Running' row under 'After Step 7' column.
If the webhook trigger never receives a signal, which steps in the execution table show Jenkins waiting?
ASteps 6 and 7
BSteps 1 and 2
CSteps 4 and 5
DSteps 8 and 9
💡 Hint
Look for 'Webhook' trigger rows with 'Wait, no build started' action.
Concept Snapshot
Jenkins Build Triggers:
- poll SCM: checks source code changes on schedule
- webhook: listens for external push events
- timer: runs builds on cron schedule
Trigger conditions start builds automatically
Multiple triggers can coexist
Build runs only when trigger condition is true
Full Transcript
This visual execution shows how Jenkins build triggers work. Jenkins can start builds by polling the source code repository for changes, by receiving webhooks from external systems, or by running on a timer schedule. Each trigger type checks its condition: if SCM has changed, if a webhook event is received, or if the scheduled time is reached. When any condition is true, Jenkins starts the build. The execution table traces these checks step-by-step, showing when builds start or wait. The variable tracker shows how key variables like SCM_Changed, Webhook_Received, Cron_Time, and Build_Running change during execution. Key moments clarify common confusions, such as why builds don't start without changes or events. The quiz tests understanding by asking about specific steps and variable states. This helps beginners see exactly how Jenkins triggers control build execution.