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.
| Trigger | How it works | When to use |
|---|---|---|
| Webhook (push event) | The Git server calls Jenkins the moment code is pushed | Best for CI. Instant, no wasted checks |
| Poll SCM | Jenkins asks Git on a schedule whether anything changed | When the Git server cannot reach Jenkins (firewalls) |
| Build periodically | Runs on a time schedule, even with no changes | Nightly builds, cleanup, reports |
| Upstream job finished | Starts after another job succeeds | Chains of jobs |
| Remote trigger (URL) | Another system calls a URL with a token | Scripts and external tools |
| Manual | A person clicks Build | Deployments that need a human decision |
Webhook From GitHub
- Install the GitHub plugin (included with suggested plugins) and make sure Jenkins has a public or reachable URL
- In the job, tick GitHub hook trigger for GITScm polling (for pipelines use the *Triggers* option in the job or a multibranch scan)
- In GitHub: repository *Settings, Webhooks, Add webhook*
- Payload URL:
https://jenkins.example.com/github-webhook/(the trailing slash matters) - Content type
application/json; events: Just the push event (and Pull requests if needed) - Push a commit. The webhook *Recent Deliveries* tab should show a green tick (HTTP 200)
| Git server | Plugin and URL |
|---|---|
| GitHub | GitHub plugin: /github-webhook/ |
| GitLab | GitLab plugin: /project/JOBNAME with a secret token |
| Bitbucket | Bitbucket plugin: /bitbucket-hook/ |
| Generic | Generic Webhook Trigger plugin: /generic-webhook-trigger/invoke?token=... |
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.
- 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).
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.
| Schedule | Meaning |
|---|---|
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-5 | Once on weekdays between midnight and 6:59 |
H 9-17/2 * * 1-5 | Every 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, @hourly | Aliases 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.
TZ=Asia/Kolkata on its own line. Put it first when you need a specific zone.
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 theupstreamtrigger option - Be careful about cycles (A starts B and B starts A)
Trigger a Build Remotely
Use this only from trusted systems. Authenticate with a user API token, not a password.
Quiet Period, Concurrency and Throttling
| Setting | Effect |
|---|---|
| Quiet period | Wait N seconds after a trigger before building, so several quick commits become one build |
| Do not allow concurrent builds | A 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 queue | If all executors are busy, builds wait in the queue |
Practice Tasks
- Set up a GitHub webhook to your lab Jenkins (use a tunnel such as ngrok if needed) and prove a push starts a build
- Switch to Poll SCM with
H/2 * * * *and watch the *Git Polling Log* - Write schedules for: every weekday at 7:30, every 10 minutes, first of the month
- Call a job with
curland an API token - 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.

