I need to run jenkins job on Monday and Thursday so will the following expression do it for me?

24.5k Views Asked by At

I need to schedule the Jenkins job on live environment every Monday and Thursday of the week.

Will the below expression help me out? Secondly I want to run it not at a single time ie want to distribute the load. So I've read about the Hash feature implemented in Jenkins. Can anyone tell me how to use that with the current expression or the new expression incase below expression is wrong?

00 19 * * 1,3,5

Thanks in advance :)

1

There are 1 best solutions below

2
Alex O On

Your expression is incorrect -- it will schedule a build every Monday (1), Wednesday (3) and Friday (5) at 7pm (19:00).

This will do what you want:

H H * * 1,4

The hash identifier "H" maps to a fixed number within the permitted range; the number is derived from the name of the job. So,

  • for the same job, "H" will always correspond to the same numbers (here: hours and minutes), but
  • different jobs will run at a different time

which will thus evenly distribute your builds over a 24 hour period.