Loading

Quipoin Menu

Learn • Practice • Grow

jenkins / Triggers
tutorial

Triggers

Instead of manually clicking "Build Now", you can trigger pipelines automatically using various triggers. Common triggers include polling SCM, cron schedules, and webhooks.

Cron Trigger (Periodic Builds)

Run a pipeline on a schedule using cron syntax. Example: every night at 2 AM.
pipeline {
triggers {
cron('H 2 * * *') # daily at 2 AM
}
stages { ... }
}
Cron syntax: MINUTE HOUR DOM MONTH DOW. Use H for hash spreading to avoid overloading.

Polling SCM

Jenkins periodically checks your source control for changes. If changes are found, it triggers a build.
triggers {
pollSCM('H/5 * * * *') # every 5 minutes
}
Requires SCM configuration (Git, etc.) in the pipeline.

Webhook / GitHub Trigger

Instead of polling, set up a webhook from GitHub to Jenkins. Install the "GitHub Integration" plugin, then configure your GitHub repository to send push events to http://jenkins-url/github-webhook/. In Jenkins, enable "GitHub hook trigger for GITScm polling".

Triggering from Another Job

Use the build step to trigger another pipeline.
stage('Trigger Downstream') {
steps {
build job: 'deploy-pipeline', parameters: [string(name: 'ENV', value: 'prod')]
}
}

Multiple Triggers

You can combine triggers. The pipeline will run if any trigger condition is met.


Two Minute Drill
  • cron('H 2 * * *') schedules periodic builds.
  • pollSCM('H/5 * * * *') polls source control for changes.
  • Webhooks provide instant triggers on code push.
  • Use build step to chain pipelines.

Need more clarification?

Drop us an email at career@quipoinfotech.com