Can I get a Jenkins trigger to run every first week day of every month?
First weekday of the month rules:
- If today is a Monday, then the job should be run if today is also the 1st, 2nd, or 3rd of the month
- If today is a Tuesday, Wednesday, Thursday, or Friday, then the job should be run if today is also the 1st of the month
The following cron expressions should do the job:
H 7 1-3 * 1
H 7 1 * 2
H 7 1 * 3
H 7 1 * 4
H 7 1 * 5
# Would last have run at Wednesday, July 1, 2015 7:00:02 AM EEST; would next run at Monday, August 3, 2015 7:00:02 AM EEST.
Beware, because of this article, you can't just use:
H 7 1-3 * 1
H 7 1 * 2-5
The above doesn't work! Instead, the job is run on every weekday, twice on the 1st of the month, and maybe twice on the 2nd and 3rd of the month!
But I was not able to reproduce it.