DevOps for Web Development: Continuous Integration with Jenkins 2.0


What is continuous integration? In simple words, CI is a software engineering practice where each check-in made by a developer is verified by either of the following:

  • Pull mechanism: Executing an automated build at a scheduled time
  • Push mechanism: Executing an automated build when changes are saved in the repository

This step is followed by executing a unit test against the latest changes available in the source code repository.

The main benefit of continuous integration is quick feedback based on the result of build execution. If it is successful, all is well; else, assign responsibility to the developer whose commit has broken the build, notify all stakeholders, and fix the issue.

So why is CI needed? Because it makes things simple and helps us identify bugs or errors in the code at a very early stage of development, when it is relatively easy to fix them. Just imagine if the same scenario takes place after a long duration and there are too many dependencies and complexities we need to manage. In the early stages, it is far easier to cure and fix issues; consider health issues as an analogy, and things will be clearer in this context.

Continuous integration is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.

CI is a significant part and in fact a base for the release-management strategy of any organization that wants to develop a DevOps culture.

Installing Jenkins

Jenkins provides us with multiple ways to install it for all types of users. We can install it on at least the following operating systems:

  • Ubuntu/Debian
  • Windows
  • Mac OS X
  • OpenBSD
  • FreeBSD
  • openSUSE
  • Gentoo
  • CentOS/Fedora/Red Hat

One of the easiest options I recommend is to use a WAR file. A WAR file can be used with or without a container or web application server. Having Java is a must before we try to use a WAR file for Jenkins, which can be done as follows:

  1. Download thewar file from https://jenkins.io/.
  2. Open command prompt in Windows or a terminal in Linux, go to the directory where the war file is stored, and execute the following command:

java – jar jenkins.war

  1. Once Jenkins is fully up and running, as shown in the following screenshot, explore it in the web browser by visiting http://localhost:8080.
  2. By default, Jenkins works on port 8080. Execute the following command from the command line:

java -jar jenkins.war –httpPort=9999

  1. For HTTPS, use the following command:

java -jar jenkins.war –httpsPort=8888

  1. Once Jenkins is running, visit the Jenkins home directory. In our case, we have installed Jenkins 2 on a CentOS 6.7 virtual machine.
  2. Go to /home//.jenkins, as shown in the following screenshot. If you can’t see the .jenkins directory, make sure hidden files are visible. In CentOS, press Ctrl+H to make hidden files visible.

Jenkins 2 Dashboard

For more details get the DevOps for Web Development book.

DevOps for Web Devlopment

It is also available at:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s