Webhook trigger vs SCM polling: what is the difference and which do you use?
IntermediateConceptFundamentals and Pipeline Design
Answer
With polling, the CI server asks the repository every N minutes whether anything changed (Jenkins pollSCM('H/5 * * * *')). It is simple and works behind firewalls but adds delay and load. With webhooks, the SCM calls the CI server's endpoint on push or PR events, giving near-instant builds with no wasted checks.
We use webhooks everywhere they can reach the server (GitHub, GitLab and Bitbucket webhooks to Jenkins' /github-webhook/ or the Generic Webhook Trigger plugin) and keep a slow poll or a nightly build only as a safety net.
More on Fundamentals and Pipeline Design
What is Continuous Integration (CI)?BeginnerWhat is the difference between Continuous Delivery and Continuous Deployment?IntermediateWhat is a CI/CD pipeline and what are its stages?BeginnerWhy should a pipeline "fail fast", and how do you order stages to achieve it?IntermediateWhat makes a build reproducible, and why does it matter?AdvancedHow does your branching strategy affect CI? Compare trunk-based development with GitFlow.Intermediate