Jenkins – how to setup build cron

Jenkins supports setting build triggers using Jenkins crons. This way build will run at regular interval and possibly Jenkins can send email on failure. Here are steps to setup cron in Jenkins project.

  1. Open Jenkins project and click on configure to open configuration screen for the project.
  2. Locate build trigger section and select build periodically.jenkins-email-build-trigger-cron
  3. To run the build every 30 minutes, enter the following cron schedule

    0,30 * * * *
    

    In case you want to introduce random delay (to avoid spike at a specific time) you can use Hash. This will run build two time in our case with some random delay introduced. Example for running builds two times in an hour using hash:

    H/30 * * * *
    
  4. Click save and now you should be able to see a build every 30 min (or approximately 30 min). Here is how build history may look like after few hours.
    jenkins-build-history-section
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments