Wednesday, October 5, 2016

How-to Schedule a Build in Jenkins


The format of the ‘Schedule’ textbox is as follows:

MINUTE (0-59), HOUR (0-23), DAY (1-31), MONTH (1-12), DAY OF THE WEEK (0-7)

The letter H, representing the word Hash can be inserted instead of any of the values, it will calculate the parameter based on the hash code of your project name, this is so that if you are building several projects on your build machine at the same time, let’s say midnight each day, they do not all start there build execution at the same time, each project starts its execution at a different minute depending on its hash code. You can also specify the value to be between numbers, i.e. H(0,30) will return the hash code of the project where the possible hashes are 0-30

Examples:

start build daily at 08:30 in the morning, Monday – Fridays:

  • 30 08 * * 1-6

weekday daily build twice a day, at lunchtime 12:00 and midnight 00:00, Sunday to Thursday:

  • 00 0,12 * * 0-5

start build daily in the late afternoon between 4:00 p.m. – 4:59 p.m. or 16:00 -16:59 depending on the projects hash:

  • H 16 * * 1-5

start build at midnight, every Saturday:

  • @midnight

or:

  • 59 23 * * 6

every first of every month between 2:00 a.m. – 02:30 a.m. :

  • H(0,30) 02 01 * *

1 comment: