Cron Expressions for Jenkins Pipelines and GitLab CI
Table of Contents
Jenkins and GitLab CI both use cron-style scheduling — but Jenkins adds its own H (hash) syntax that standard cron tools don't support, and GitLab CI runs all schedules in UTC with no randomization option. Use our free cron expression generator to build the base 5-field expression, then adapt it to each platform's requirements below.
This guide covers Jenkins Pipeline triggers, Poll SCM, GitLab CI scheduled pipelines, and how to migrate schedules between the two platforms.
Jenkins Cron vs Standard Cron: The H Syntax
Jenkins uses standard 5-field cron syntax but adds a special H (hash) symbol. Instead of specifying an exact minute or hour, H tells Jenkins to pick a consistent but randomized value for that job. This spreads load across your Jenkins agents instead of hammering them all at the top of the hour.
| Pattern | Standard Cron Meaning | Jenkins H Meaning |
|---|---|---|
0 * * * * | Every hour at :00 | Every hour at :00 (all jobs at same time) |
H * * * * | Not valid | Every hour at a job-specific random minute |
H/15 * * * * | Not valid | Every 15 minutes, starting at random minute |
H 2 * * * | Not valid | Daily at a random time near 2 AM |
H(0-29) * * * * | Not valid | Random minute in first 30 minutes, every hour |
Why H matters: if you have 50 pipelines all scheduled with 0 * * * *, they all trigger simultaneously. With H * * * *, Jenkins hashes each job name to a unique minute, spreading the load automatically — yet each individual job still runs at the same time every hour.
Common Jenkins Pipeline Cron Triggers
In a Jenkins Pipeline, cron schedules go inside the triggers block:
pipeline {
triggers {
cron('H 2 * * *')
}
stages { ... }
}
Common Jenkins cron patterns (use H instead of fixed minutes for production):
| Goal | Standard cron | Jenkins H equivalent |
|---|---|---|
| Every 15 minutes | */15 * * * * | H/15 * * * * |
| Every hour | 0 * * * * | H * * * * |
| Daily at 2 AM | 0 2 * * * | H 2 * * * |
| Weekdays only at 8 AM | 0 8 * * 1-5 | H 8 * * 1-5 |
| Weekly on Sunday | 0 3 * * 0 | H 3 * * 0 |
| Twice daily | 0 6,18 * * * | H 6,18 * * * |
Jenkins also supports @hourly, @daily, @weekly, @monthly, and @midnight shortcuts. These automatically use H-based randomization.
Poll SCM: Cron for Source Code Polling
Jenkins "Poll SCM" checks your repository on a cron schedule and triggers a build only if changes are detected. The syntax is identical to regular cron triggers:
pipeline {
triggers {
pollSCM('H/5 * * * *')
}
}
Poll SCM best practice: Use H/5 or H/10 rather than */5 to spread polling across agents. For most teams, webhooks from GitHub/GitLab are better than polling — they trigger builds immediately and put zero load on Jenkins between pushes. Use poll SCM only when webhooks aren't available (firewalled Jenkins, legacy SCM systems).
Generate the base expression with our cron generator, then replace any fixed minute with H for production Jenkins use.
GitLab CI Scheduled Pipelines: Standard Cron in UTC
GitLab CI scheduled pipelines use standard 5-field cron syntax with no H extension. Configure them in CI/CD → Schedules in the GitLab UI, or via the GitLab API.
Key differences from Jenkins:
- UTC only — GitLab runs all schedules in UTC. There is no timezone option in the schedule UI (as of GitLab 16+). Convert your local time to UTC before setting the schedule.
- No H syntax — must use specific minute/hour values. If you have many pipelines at the same time, they all run simultaneously (no load distribution).
- Minimum interval — GitLab throttles very frequent schedules on GitLab.com. Intervals under 60 minutes may be limited.
- Branch scoped — each scheduled pipeline specifies a target branch. You can schedule the same cron expression against different branches.
GitLab CI schedule format in the UI:
Description: Nightly build
Interval Pattern: 0 2 * * * (2 AM UTC every night)
Target Branch: main
Active: Yes
Convert your local time to UTC using our timestamp converter before setting GitLab schedules.
Migrating Cron Schedules Between Jenkins and GitLab
When migrating pipelines from Jenkins to GitLab CI (or vice versa), cron schedules need adjustment:
Jenkins → GitLab:
- Replace
Hwith a specific minute. ForH 2 * * *, pick any minute:37 2 * * *. - For
H/15 * * * *, use*/15 * * * *(exact every-15-minutes). - Verify the timezone: Jenkins typically uses server timezone, GitLab.com uses UTC. Adjust hour values accordingly.
GitLab → Jenkins:
- Replace fixed minutes with H for better load distribution.
- Move from GitLab UI configuration to Jenkinsfile
triggers { cron(...) }blocks. - Confirm Jenkins agent timezone with
datecommand if jobs aren't running when expected.
| Goal | GitLab CI (UTC) | Jenkins Pipeline |
|---|---|---|
| Daily at 2 AM EST (UTC-5) | 0 7 * * * | H 7 * * * |
| Weekdays business hours | 0 9-17 * * 1-5 | H 9-17 * * 1-5 |
| Every 30 minutes | */30 * * * * | H/30 * * * * |
| First of month midnight | 0 0 1 * * | H 0 1 * * |
Build Your Jenkins or GitLab Cron Expression
Use our free cron generator to build the base 5-field expression, then adapt:
- Set your schedule in the generator (minute, hour, day, month, weekday).
- Copy the output (e.g.,
0 2 * * 1-5). - For Jenkins: Replace fixed leading zeros with
Hwhen possible —H 2 * * 1-5. - For GitLab: Confirm the hour is UTC. Use the expression as-is.
- Validate with the crontab visualizer to see the next 20 run times.
Jenkins H-based patterns can't be validated in standard cron tools — they're Jenkins-only syntax. Validate the equivalent standard expression (replace H with a specific number) to confirm the schedule logic is right, then convert back to H for the actual Jenkinsfile.
Try It Free — No Signup Required
Runs 100% in your browser. No account, no install, no limits.
Open Free Cron GeneratorFrequently Asked Questions
Does H syntax work in GitLab CI?
No. GitLab CI uses standard POSIX cron syntax only. The H symbol is Jenkins-specific. In GitLab, you must use a specific minute value (0-59). To achieve load distribution similar to Jenkins H, manually stagger your pipeline schedules at different minutes.
How do I check what timezone my Jenkins server uses for cron?
Run a freestyle job with the shell command "date" — this shows the server's current timezone. You can also check the Jenkins system information page at /systemInfo. To change the Jenkins cron timezone, set the JENKINS_HOME/hudson.model.Hudson.cronfmt.timezone system property or configure it in the Jenkins global settings.
Can I use the same crontab for both Poll SCM and build triggers in Jenkins?
Yes — a Jenkins Pipeline can have both a cron trigger and a pollSCM trigger simultaneously. The cron trigger fires unconditionally on schedule; pollSCM fires only if changes are detected. Use both when you need guaranteed nightly builds regardless of commits (cron) plus fast feedback on pushes (pollSCM or webhooks).

