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:
- 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.
- 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.
- 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.
- RSS/E-mail/IM Integration - There are various options available to notify the team members about successful or failed builds.
- JUnit/TestNG test reporting - Test reports can be tabulated, summarized, and displayed with history information. History trends are plotted in a graph.
- Distributed builds - It is possible to distribute the load of preparing builds across multiple workstations.
- 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.
- 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.
Figure 1: 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.
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.
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.
Figure 5: 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.
Figure 7: Jenkins shows the Build History with the information such as build status, time of build and console log.
Other Jenkins Plug-Ins
There are over 150 plug-ins in this tool, including:
- Artifact Uploaders
- Build Notifiers
- Build Reports
- Build Tools
- Build Triggers
- Build Wrappers
- Cluster Management
Other Popular Continuous Integration (CI) Tools
- Apache Continuum - Continuous integration server supporting Apache Maven and Apache Ant
- CruiseControl - Java based framework
- Tinderbox - Mozilla-based product
- Bamboo - by Atlassian Software Systems
- TeamCity - by JetBrains
- Team Foundation - Server by Microsoft
- 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 .
Hasan Sunasara: Who loves to design, develop and tune Java EnterpriseApplications. I strive to learn new things and improve on every possible areas touched by on the path of life. When not working on Java, I socialize, read blogs and watch movies.