Interview Prep/CI/CD/Fundamentals and Pipeline Design

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.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Fundamentals and Pipeline Design