DevOps Zone is brought to you in partnership with:

Jessica Thornsby is the Technical and Creative Copywriter at WANdisco, where she writers regular tutorials on Apache Subversion, TortoiseSVN, uberSVN, and all things version control. She spends her spare time editing the CD reviews section at www.leedsmusicscene.net, contributing to A Short Fanzine About Rocking, and researching her family tree. You can find her on Twitter @jthornsby Jessica is a DZone MVB and is not an employee of DZone and has posted 29 posts at DZone. You can read more from them at their website. View Full User Profile

Bringing Order to Your Jenkins Jobs

07.27.2012
| 8513 views |
  • submit to reddit

Once you’ve been working with Jenkins and uberSVN for a while, you may find yourself in a situation where you have several jobs that need to run in a specific order, for example:

  • Job 1 and Job 3 can run simultaneously.
  • BUT Job 2 should only start when Job 1 and Job 3 have finished running.
  • AND Job 4 should only start when Job 2 has finished.

How can you implement this complicated setup? This is where Jenkins’ ‘Advanced Project Options’ and build triggers come in handy. In this tutorial, we’ll walk through the different options for scheduling jobs using Jenkins and uberSVN, the free ALM platform for Apache Subversion.

Note, this tutorial assumes you have already created a job and configured it to automatically poll your Subversion repository.

1) Open the Jenkins tab of your uberSVN installation and select a job.

2) Click the ‘Configure’ option from the left-hand menu.

3) In the ‘Advanced Project Options’ tab, select the ‘Advanced…’ button

4) This contains two options that are useful for ordering your jobs:

  • Block build when upstream project is building – blocks builds when a dependency is in the queue, or building. Note, these dependencies include both direct and transitive dependencies.
  • Block build when downstream project is building – blocks builds when a child of the project is in the queue, or building. This applies to both direct and transitive children.

If this option doesn’t meet your needs, you can explicitly name a project (or projects) that must be built before your job is allowed to run. To set this:

1) Scroll down to the ‘Build triggers’ tab on the configure page.

2) Select the ‘Build after other projects are built’ checkbox. This will bring up a text box where you can list any number of projects.

Utilized properly, the build triggers and advanced project options should allow you to organize your jobs into a schedule. Tip, if you need even more control over your build schedule, there are plenty of scheduling plugins available. To add plugins to Jenkins, simply:

1) Open the ‘Manage Jenkins’ screen.

2) Click the ‘Manage Plugins’ link.

3) Open the ‘Available’ tab and select the appropriate plugins from the list.

Published at DZone with permission of Jessica Thornsby, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)