Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 611
JeffH Avatar asked Mar 01 '12 17:03

JeffH


People also ask

How do I schedule a Jenkins periodically?

The steps for schedule jobs in Jenkins:click on "Configure" of the job requirement. scroll down to "Build Triggers" - subtitle. Click on the checkBox of Build periodically. Add time schedule in the Schedule field, for example: @midnight.

What is periodic trigger in Jenkins?

periodic(int minutes) Triggers a build periodically if not otherwise run.

Can Jenkins build be triggered automatically?

Follow the steps as mentioned below to trigger a Jenkins job automatically based on GitHub's webhook configurations: Step 1: Go to the Configuration page of the respective job and under the build trigger section, check the "GitHub hook trigger for GITScm polling" checkbox and click on the Save button.


1 Answers

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.

like image 109
Lars Kotthoff Avatar answered Sep 21 '22 06:09

Lars Kotthoff