Jenkins: An Introduction

I've mentioned Jenkins in passing in a few recent posts, so I thought I'd provide a little more detail about what it is and what it can do for you.  Among other things, Jenkins provides a centralized platform for building and testing software.  It's specifically targeted for use in continuous integration, an iterative approach to development intended to provide rapid feedback to changes in an application, minimizing the time between the introduction of a bug and its detection.  In a typical continuous integration setup after a developer checks in a code change Jenkins would detect it and kick off a build of the software, run tests against the new build, and publish the results of the test-- and do all of this automatically.  Each of the tasks comprising a Jenkins job can be added and configured independently, so, for example, you can choose to run tests independent of the build process and run them on demand, on a schedule, etc.  You can also set up "slave" machines to distribute processing of Jenkins jobs.

You can download a Jenkins installation from http://www.jenkins-ci.org; available packages include a Java WAR (web application archive) or packages covering most major desktop platforms.  Once installed, the Jenkins dashboard is available as a web page on its host machine (on port 8080 by default); here's a screenshot of a typical dashboard with a project already added:


The columns in the projects list should be pretty straightforward for the most part (Name, Last Success, Last Failure, etc.), but extra explanation of the icon-based columns may be helpful.  The first column (simply labelled "S") indicates the status of the last run of this project/job.  The indicator can be blue (indicating no problems), yellow (mixed results: typically, the build step might have completed successfully, but tests failed), or red (severe failure: e.g., the build step failed).  The second column ("W" for "Weather Report") indicates status trends over the last few runs of the project/job-- the weather icon gets "stormier" as more jobs fail and "sunnier" as results improve.  The last column is simply a run button to kick off a job on demand.

Creating a basic Jenkins job involves configuring build options, build tasks, and post-build tasks:

- Build options include setting up code sources and build trigger(s), specifying build dependencies, etc.  Build trigger options allow you to start a new build (and any subsequent tasks including tests) based on changes to code in a source control system, on a scheduled basis, both, neither, etc.

- In addition to actually performing a build of a project's code, build tasks can also include running tests or just about anything else that can be done through the command line (in Windows) or shell.

- Post-build tasks involve processing the results of your build tasks; typical post-build tasks include sending email notifications of build and test results to stakeholders, publishing results, kicking off another project, etc.

Again, Jenkins was created with continuous integration in mind, so configuration settings are very "build-centric"-- but even performing a build is optional; Jenkins can be useful even if you're not involved in continuous integration.  For example, you could use it to monitor the health of a web service, running a set of tests against the service on a scheduled basis, or as a centralized "control center" for web service tests, allowing authorized users to kick them off remotely and review published results.

With its core capabilities alone Jenkins is pretty versatile, but it's also amazingly extensible.  There are hundreds of plug-ins available that can be installed through the Plugin Manager of the Jenkins dashboard itself, many without any disruption to Jenkins (no need to re-start the service):


That's it for an intro to Jenkins; in my next post I'll dig into some of the nuts and bolts of adding a project.