Continuous Integration with Jenkins: How? and Why?

Ken Karthik
Aug 27, 2017 · 4 min read

Continuous Integration(CI) is one of the most popular development practices that is being implemented in different kind of projects, independently of its size, programming languages, technologies… On this article you will learn about Continuous Integration, which benefits you can get by practicing CI and how you can start with it. Finally, we will discuss about Jenkins; A star tool that we can use in order to implement Continuous Integration. Also you will learn about how to configure Jenkins and create a basic Freestyle job.

What is Continuous Integration?

I will start with the definition provided by Martin Fowler, one “guru” of Continuous Integration:

Fig 1. CI Definition by M. Fowler.

That was long, right? However this a really good definition about what Continuous Integration is. I will explain each sentence.

1. “Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day…”. If you are part of a development team, is probably that you integrate your daily work to a place like a repository to track your changes in order to implement the “version control” practice. Now, we have identified that “version control” is important on CI.
2. “Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible”.
How you can verify these changes? Well, you will need a Continuous Integration server. This server provides the necessary to clone the code with the changes and create an automated build. This server must be set up with the environment. For example. If you are working over a Java project, you must install and configure Maven, Gradle or any other build tool in order to create this automated build.
3. How can you detect errors quickly? After you send a change to a remote repository (commit), the CI server will detect these changes and will execute an automated build immediately. If something went wrong, it will send a notification to all team members, so, you can take actions to fix any issue.

Fig 2. Continuous Integration flow.

You can identify that there are many actors that are part of CI practice, some of them are:
Team Members: They have to commit their changes daily to a remote repository.
Repository Managers: They provide versioning control. (Some of the most popular are: GitHub, Bitbucket, GitLab…).
Continuous Integration Server: One of the keys for CI. The CI Server generates and automated build, executes tests, generates artifacts, interacts with external tools…
External Tools: You can link external tools to your CI Server in order to extend its functionality.

How to start implementing Continuous Integration?

One of the best practices is implementing CI as early as possible, also understanding the workflow of your current development process. You have to keep in mind that sending your changes to a repository is a crucial step, because, version control practice is the core of Continuous Integration. On the other hand, you should do a research about the different Continuous Integration servers that exist and what each of them offer in order to take advantage of all of the features.

Which benefits you can get by implementing CI?

There are several benefits that you can get by implementing CI:
Reducing Risks: By implementing CI, you can detect any issue after or during a build execution, this lets you to take actions to fix the errors.
Automating processes: You can automate different processes, such as several kind of tests( Unit Tests, Performance Tests…), building artifacts…
By automating the processes, you can reduce the time and effort that is necessary to invest on manual methods. Also it reduces the human error.
Taking actions at Management level: You can get an overview of the current status of your project, because, CI, lets you monitoring each change that the team members commit daily. Understanding the project status helps at making decisions such as extending the delivery date, actions for possible risks due constant failures builds…

Analysis and reporting: With Continuous Integration is possible to use Code Coverage, static code analysis and other tools that generates reports about the health of the project and statistics.

Collaboration: Each team member commits their changes, also these changes could be verified by an automated build that should be visible for the all team. This practice allows the collaboration among the members, because they can suggest any improvement or change that can help to minimize risks and issues.

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade