Lesson content
Read, practise, then check your understanding
Build Triggers: SCM, Webhooks, and Schedules
A trigger connects external change or time to a Jenkins build. Webhooks provide fast event-driven feedback. SCM polling checks for changes on a schedule. Cron starts work regardless of source changes, while upstream relationships chain jobs.
Core ideas
- A webhook is usually lower latency and load than frequent SCM polling.
pollSCMevaluates source changes on a Jenkins schedule; it does not necessarily build at every interval.cronschedules the pipeline itself. Jenkins supportsHto hash start times and spread load.- Multibranch pipelines discover branches and pull requests and load their Jenkinsfiles.
How it works
Authenticate webhook endpoints, verify delivery logs, and avoid triggering the same build through both webhook and polling unless deduplication is intentional. Use schedules for maintenance or periodic verification, not as a substitute for reliable event delivery.
Configuration example
pipeline {
agent any
triggers {
pollSCM('H/15 * * * *')
cron('H 2 * * 1-5')
}
stages {
stage('Nightly verification') {
steps { sh './ci/full-verification.sh' }
}
}
}
The sample is intentionally small. In a real installation, replace hostnames, labels, credentials, retention, and commands with reviewed values from your own platform standards.
Production guidance
- Use
Hrather than a fixed minute to reduce synchronized controller load. - Restrict expensive scheduled jobs and add timeouts so overlap cannot grow without bound.
- Log the source event, revision, branch, and cause to make unexpected runs traceable.
The chapter quiz follows this lesson and tests both terminology and safe operating choices.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.