jenkinscroncronexpression

Can I set Jenkins' "Build periodically" to build every other Tuesday starting March 13?


I want to schedule Jenkins to run a certain job at 8:00 am every Monday, Wednesday Thursday and Friday and 8:00 am every other Tuesday.

Right now, the best I can think of is:

# 8am every Monday, Wednesday, Thursday, and Friday:
0 8 * * 1,3-5

# 8am on specific desired Tuesdays, one line per month:
0 8 13,27 3 2
0 8 10,24 4 2
0 8 8,22 5 2
0 8 5,19 6 2
0 8 3,17,31 7 2
0 8 14,28 8 2
0 8 11,25 9 2
0 8 9,23 10 2
0 8 6,20 11 2
0 8 4,18 12 2

which is is fine (if ugly) for the remainder of 2012, but it almost certainly won't do what I want in 2013.

Is there a more concise way to do this, or one that's year-independant?


Solution

  • This is something that comes up quite often, see e.g. this document, this forum thread or this stackoverflow question.

    The answer is basically no. What I would do in your situtation is to run the job every Tuesday and have the first build step check whether to actually run by e.g. checking whether a file exists and only running if it doesn't. If it exists, it would be deleted so that the job can run the next time this check occurs. You would of course also have to check whether it's Tuesday.