Jenkins Build Triggers: Git Webhooks, SCM Polling, Cron Schedule Syntax and Upstream Jobs

CI CD Pipelines with Jenkins 30 min min read Updated: Nov 17, 2026 Beginner
Jenkins Build Triggers: Git Webhooks, SCM Polling, Cron Schedule Syntax and Upstream Jobs
Beginner Topic 1 of 3

Why Triggers Matter

CI means a build starts every time code changes. Nobody should click *Build Now* all day. Jenkins offers several triggers. Choose the best one for each case.

TriggerHow it worksWhen to use
Webhook (push event)The Git server calls Jenkins the moment code is pushedBest for CI. Instant, no wasted checks
Poll SCMJenkins asks Git on a schedule whether anything changedWhen the Git server cannot reach Jenkins (firewalls)
Build periodicallyRuns on a time schedule, even with no changesNightly builds, cleanup, reports
Upstream job finishedStarts after another job succeedsChains of jobs
Remote trigger (URL)Another system calls a URL with a tokenScripts and external tools
ManualA person clicks BuildDeployments that need a human decision

Webhook From GitHub

  1. Install the GitHub plugin (included with suggested plugins) and make sure Jenkins has a public or reachable URL
  2. In the job, tick GitHub hook trigger for GITScm polling (for pipelines use the *Triggers* option in the job or a multibranch scan)
  3. In GitHub: repository *Settings, Webhooks, Add webhook*
  4. Payload URL: https://jenkins.example.com/github-webhook/ (the trailing slash matters)
  5. Content type application/json; events: Just the push event (and Pull requests if needed)
  6. Push a commit. The webhook *Recent Deliveries* tab should show a green tick (HTTP 200)
Git serverPlugin and URL
GitHubGitHub plugin: /github-webhook/
GitLabGitLab plugin: /project/JOBNAME with a secret token
BitbucketBitbucket plugin: /bitbucket-hook/
GenericGeneric Webhook Trigger plugin: /generic-webhook-trigger/invoke?token=...
Webhook not firing? Check (1) the GitHub delivery log status, (2) that Jenkins is reachable from the internet or through a tunnel or proxy, (3) the Jenkins URL setting, (4) the CSRF crumb or required authentication (webhook endpoints are allowed anonymously), and (5) the job really has the trigger enabled.

Poll SCM

If webhooks are impossible, tick Poll SCM and give a schedule. Jenkins checks the repository and starts a build only if there is a new commit.

text H/5 * * * * # about every 5 minutes
  • Polling uses controller resources and is delayed by up to the interval
  • Never poll every minute for many jobs. Use webhooks instead

The Cron Syntax and the H Symbol

Jenkins uses five fields like Linux cron, plus the special symbol H (hash).

text MINUTE HOUR DAY-OF-MONTH MONTH DAY-OF-WEEK 0-59 0-23 1-31 1-12 0-7 (0 and 7 are Sunday)

H means *a number chosen from the job name*, so that many jobs with the same schedule do not all start at the same second and overload the server.

ScheduleMeaning
H/15 * * * *Every 15 minutes at a spread-out minute
H * * * *Once an hour
H 2 * * *Once a night, sometime between 2:00 and 2:59
H H(0-6) * * 1-5Once on weekdays between midnight and 6:59
H 9-17/2 * * 1-5Every two hours from 9 to 17 on weekdays
0 0 1 * *At exactly midnight on the first day of each month (no H)
@daily, @weekly, @monthly, @hourlyAliases that also use H spreading

Jenkins shows a preview under the field: *Would last have run at ... would next run at ...*. Check it every time.

Time zone: The schedule uses the controller's time zone unless you start the field with TZ=Asia/Kolkata on its own line. Put it first when you need a specific zone.
text TZ=Asia/Kolkata H 6 * * 1-5

Upstream and Downstream

  • In a freestyle job: *Build after other projects are built* with the upstream job name (build only if stable)
  • In a pipeline: use build job: 'deploy-app' inside a stage, or the upstream trigger option
  • Be careful about cycles (A starts B and B starts A)
groovy pipeline { agent any triggers { cron('H 2 * * *') pollSCM('H/5 * * * *') upstream(upstreamProjects: 'build-library', threshold: hudson.model.Result.SUCCESS) } stages { stage('Build') { steps { echo 'running' } } } }

Trigger a Build Remotely

Use this only from trusted systems. Authenticate with a user API token, not a password.

bash # 1) Create an API token: your user menu, Security, API Token, Add new token # 2) Call the job curl -X POST -u alice:11abc...token https://jenkins.example.com/job/hello-jenkins/build curl -X POST -u alice:11abc...token "https://jenkins.example.com/job/hello-jenkins/buildWithParameters?TARGET=staging&COLOR=blue" # Check status curl -s -u alice:TOKEN https://jenkins.example.com/job/hello-jenkins/lastBuild/api/json | jq '.result'

Quiet Period, Concurrency and Throttling

SettingEffect
Quiet periodWait N seconds after a trigger before building, so several quick commits become one build
Do not allow concurrent buildsA new build waits until the previous one finishes (pipeline option disableConcurrentBuilds())
Throttle builds (plugin)Limit how often or how many builds of a category run at once
Build queueIf all executors are busy, builds wait in the queue

Practice Tasks

  1. Set up a GitHub webhook to your lab Jenkins (use a tunnel such as ngrok if needed) and prove a push starts a build
  2. Switch to Poll SCM with H/2 * * * * and watch the *Git Polling Log*
  3. Write schedules for: every weekday at 7:30, every 10 minutes, first of the month
  4. Call a job with curl and an API token
  5. Make a nightly job and read the preview of its next run

Conclusion

Use webhooks for instant CI, Poll SCM only when you must, cron for scheduled work, and upstream or remote triggers for chains. Learn the Jenkins cron fields and the H symbol, always check the schedule preview and use API tokens for remote calls.

Quick Summary: webhook /github-webhook/; pollSCM; cron fields + H; TZ=; upstream/downstream; curl with API token; quiet period + disableConcurrentBuilds.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators