Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want Jenkins job to build every two weeks

Tags:

jenkins

Will this expression run the build every other Friday at noon? Assume i set this up on a Friday?

0 12 * * */14

I tried 0 12 * * FRI/14 but Jenkins returned an error.

I ma trying to run a code report job every two weeks to match scrum.

like image 732
Eric Hanzl Avatar asked Nov 18 '15 16:11

Eric Hanzl


People also ask

How do you make a Jenkins job periodically?

Add a Schedule to a Jenkins Job Now, check the Build periodically box in the Build Triggers section. This will open the scheduling text area. Next, let's set the job to run every five minutes. Enter H/5 * * * * into the box, click Save, and reopen the configuration.

How do I schedule a Jenkins job to run at a specific time?

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.

How do I schedule Jenkins pipeline?

Let's select stage: Stage in the Sample Step drop-down, type scm in the Stage Name text field and click Generate Pipeline Script: Let's save it. The first statement, node('master') in the script above, indicates that the job will be executed on a node named master, which is the default node on the Jenkins server.


1 Answers

You'll have to add some logic to the build script to determine if it ran last week, and then run it every week.

I looked around similar questions for cron jobs, and you have to do some shell magic to make it work.

You could try what was suggested here:

H H 8-14,22-28 * 5

Which would qualify on Fridays that are in the second or fourth week of the month.

like image 138
danehammer Avatar answered Oct 27 '22 23:10

danehammer