In a previous article, entitled, “Continuous Integration: How to Avoid ‘Integration Hell’, we discussed the general issues and considerations of the continuous integration environment and projects. In this article, we will discuss Jenkins (previously known as Hudson), which is one of the most popular continuous integration (CI) tools, and how you can achieve Continuous Integration using this tool.
The Jenkins tool is an open source Continuous Integration tool which is written in Java, and runs in a servlet container like Apache Tomcat. It can be used to build software written in various languages such as Java, .Net, PHP, C++ etc. This open-source, free software is available under MIT License.

###

Jenkins features include:
1. Building/testing software projects continuously – You can create Build Jobs in Jenkins. There are various configuration options available related to building the software, e.g. code repository, build scheduling, executing test scripts, generating reports etc.
2. Monitoring the execution of repeated jobs -Jenkins monitors and logs the information related to the execution of repeated build jobs. It maintains the build history with time and status information. Users can also see the console log for particular build instance.
3. SCM Integration, e.g., SVN, Git etc. – Jenkins integrates with wide range of popular SCM tools such as Git, CVS, SVN, Perforce, Mercurial, Team Foundation etc.
4. RSS/E-mail/IM Integration – There are various options available to notify the team members about successful or failed builds.
5. JUnit/TestNG test reporting – Test reports can be tabulated, summarized, and displayed with history information. History trends are plotted in a graph.
6. Distributed builds – It is possible to distribute the load of preparing builds across multiple workstations.
7. Authorization – Jenkins can be configured to have role-based access for the build jobs. This is helpful for big organizations where the same CI server is used to build multiple projects by different teams.
8. Plug-in Support – Various plug-ins are available and Jenkins can be integrated with well-known development tools so developers can write plug-ins to suit the unique requirement of the team.

Jenkins supports following tools in different categories:
SCM vendors: Git, CVS, SVN, Perforce, Mercurial, Team Foundation and many more.
Build tools: Ant, Maven, Gradle, MSBuild, NAnt, Rake and many more.
Unit Testing frameworks: JUnit, NUnit, Selenium, CppNCSS, TestNG, Xunit and many more.
Code Coverage tools: Clover, Cobertura, Emma, Serenity, Sonar, NCover and many more.
Code Analysis Tools: Checkstyle, PMD, Dry, Findbugs, Warnings, CCM, Violations and many more.
Security Tools: LDAP, Active Directory, Crowd and many more.
Applications servers: Weblogic, Glassfish, Tomcat, JBoss etc.
Virtual Environment: EC2, Virtual Box, VmWare, JCloud etc.
Social communication: E-mail, IRC, Jabber, Twitter etc.

To integrate particular tools with Jenkins, you need to install relevant plug-ins from the Plug-in Manager, as part of the configuration. Once the initial set of plug-ins is established, it is also possible to install new plug-ins later as required.

Sample Screenshots:
Figure 1: The Jenkins dashboard shows the list of jobs with various options such as execute job, view console, build health etc.
The Jenkins dashboard shows the list of jobs with various options such as execute job, view console, build health etc.

 

Figure 2: From the Plug-in Manager you can find available plug-ins, check updates and see installed plug-ins.
:  From the Plug-in Manager you can find available plug-ins, check updates and see installed plug-ins.

 

Figure 3: From here you can create new a Build Job, and provide a meaningful name to the job, based on the project. You can configure the code repository and provide parameters related to other build options.
From here you can create new a Build Job, and provide a meaningful name to the job, based on the project. You can configure the code repository and provide parameters related to other build options.

 

Figure 4: As part of configuring Build Job, you can also configure the tool to send email notifications to different people to notify them of various events, and link the deployment server to deploy the build after successful completion, as well as other options.
As part of configuring Build Job, you can also configure the tool to send email notifications to different people to notify them of various events, and link the deployment server to deploy the build after successful completion, as well as other options.

 

Figure 5: In this view, you can see the console output with information related to the execution of the build, test scripts, deployment etc.
: In this view, you can see the console output with information related to the execution of the build, test scripts, deployment etc.

 

Figure 6: This is a sample email sent from Jenkins to the developer who broke the build, along with information related to the SVN code file updates
: This is a sample email sent from Jenkins to the developer who broke the build, along with information related to the SVN code file updates.

Other Jenkins Features:

  1. PMD for automated code analysis
  2. Cobertura for code coverage
  3. Selenium for functional testing
  4. JIRA to update issues/features
  5. IM integration for instant notification

Other Jenkins Plug-Ins:
There are over 150 plug-ins in this tool, including:

  1. Artifact Uploaders
  2. Build Notifiers
  3. Build Reports
  4. Build Tools
  5. Build Triggers
  6. Build Wrappers
  7. Cluster Management

Other Popular Continuous Integration (CI) Tools:
Open Source:

  1. Apache Continuum Continuous integration server supporting Apache Maven and Apache Ant
  2. CruiseControl Java based framework
  3. Tinderbox Mozilla-based product

Commercial:

  1. Bamboo by Atlassian Software Systems
  2. TeamCity by JetBrains
  3. Team Foundation Server by Microsoft
  4. Rational Team Concert by IBM

Jenkins and other Continuous Integration (CI) can be used to automate the process of code integration, making the build and release management easier, faster and more reliable. These tools make the development process smooth, reduce code errors, increase the productivity of the developers and optimize the deployment and delivery of the software solution.