Multi-cron trigger pattern (Pipeline)
In a declarative pipeline, the triggers directive accepts multiple cron lines. Each line is a separate trigger; Jenkins fires whichever matches the current time.
pipeline {
agent any
triggers {
cron('''
0 0 30 4,6,9,11 *
0 0 31 1,3,5,7,8,10,12 *
0 0 28 2 *
''')
}
stages {
stage('Month-end') {
steps {
// ... your last-day-of-month work
}
}
}
}The triple-quoted string is parsed line-by-line. The Feb 28 line covers non-leap years; for leap-year-safe handling, add a fourth line for Feb 29 plus a runtime check.