What is Continuous Integration?

Last updated on Jun 05,2023 11.1K Views

What is Continuous Integration?

edureka.co

Continuous Integration is a development practice where developers integrate code into a shared repository frequently where each integration is verified by an automated build and automated tests. It is the most important part of DevOps that is used to integrate various DevOps stages. In this blog, we will deal with the problems developers face while writing, testing and delivering software to end users and how they solve it using CI.

In this blog, we will focus on the below topics:

    1. Traditional Integration
    2. Problems with Traditional Integration
    3. What is Continuous Integration?
    4. Benefits of Continuous Integration
    5. Requirements for CI System
    6. What is Jenkins – The Ultimate CI Tool
    7. Demo on Continuous Integration Using Jenkins

Traditional Integration

In Traditional Integration or/software development cycle,

The main factors that can make these problems escalate:


Want to Explore more About DevOps?

Problems With Traditional Integration

 

What’s the Solution for Problems faced in Traditional Integration?

So, below are the steps to solve the above problems:

So, let us see what exactly is Continuous Integration?

What is Continuous Integration?

We Will Start with the Martin Fowler’s Definition:

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. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.

– Martin Fowler

Automating your build, test and deploy processes can increase the problems commonly happening on projects. So we should have a reliable method of integrating that will ensure that the errors can be found sooner than later.

What is Continuous Integration? | Edureka

This Edureka video on Continuous Integration explains the concept of Continuous Integration, its benefits and its Tools (Jenkins).

Let’s move on and see what are the benefits of Continuous Integration.

Benefits of Continuous Integration

  1. Reduced Integration Risk: Often, working on projects means multiple people are working on the separate tasks or parts of the code which makes it risky to integrate. Debugging and solving the issue can be really painful and can potentially mean a lot of changes to the code. Integrating more frequently can help reduce these kinds of problems to a minimum.
  2. Higher Code Quality: Focusing more on the functionality of the code results in a higher quality product.
  3. The Code in Version Control works: If you commit something that breaks the build, you and your team get the notice immediately and the problem is fixed before anyone else pulls the “broken” code.
  4. Reduced friction between team members: Having the impartial system in place reduces the frequency of quarrels among team members.
  5. Easy for QA Team: Having different versions and builds of the code can help isolate and trace bugs efficiently, and it makes life easier for the QA team.
  6. Less time deploying: Deploying projects can be very tedious and time-consuming, and automating that process makes perfect sense.

Requirements for CI System

But you might be wondering what are the requirements for the installing of the CI system for your needs. If you want to install CI server in your own environment, you’ll need a few things first.

Master Continuous Integration

What is Jenkins – The Ultimate CI Tool

Jenkins is an open source automation tool written in Java with plugins built for Continuous Integration purpose. Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. It also allows you to continuously deliver your software by integrating with a large number of testing and deployment technologies.

With Jenkins, organizations can accelerate the software development process through automation. Jenkins integrates development life-cycle processes of all kinds, including build, document, test, package, stage, deploy, static analysis and much more.

Jenkins achieves Continuous Integration with the help of plugins. Plugins allow the integration of Various DevOps stages. If you want to integrate a particular tool, you need to install the plugins for that tool. For example Git, Maven 2 project, Amazon EC2, HTML publisher etc.

The image below depicts that Jenkins is integrating various DevOps stages:

Demo on Continuous Integration Using Jenkins

A company named Sanders & Fresco Private Ltd. got the project from a client which consisted of 4 modules. The Project manager divided these modules between two developers. Now to maintain the consistency in the flow of the project, they built a Continuous Delivery Pipeline where they executed all the modules in terms of jobs (a single job will have two modules). After building those jobs, they synced it in a pipeline. They also checked the build at regular intervals of time while they were developing their project. So, the path of the project which was in git hub repository was provided through Jenkins. Using the concept of CI, they built their project after a fixed interval of time which can be defined by build trigger option in Jenkins. 

So, let us see how we can do this using Jenkins.

Step 1: Open the Jenkins on your designated port number in your VM.

Step 2: Click on New Item to create a new Job.

Step 3: Give the name of Freestyle Project. Here I have given Job1.

Step 4: Now go to Source Code Management-> Git. Fill the project path to pull the project from Git and Click on Apply. 

Step 5: Click on Build Now.

Step 6: The Job1 will start building it.

Now we will create a project/Job2 which will build after a fixed interval of time (i.e. after every minute) which we can define by using Poll SCM.

Step 7: Click on New Item to create a new Job.

Step 8: Give the name of Freestyle Project. Here I have given Job2.

Step 9: Now go to Source Code Management-> Git. Fill the project path to pull the project from Git and Click on Apply. 

Step 10: Then go to Build Trigger -> Poll SCM. Enter ” * * * * * ” to build the Job2 after every minute and click on Apply.  

After clicking on Apply, a message will be displayed. Click on Save button.

Step 11: Click on Build Now.

Step 12: The Job2 will start building after every minute. 

Note: To check for build status, Click on Git Polling Log. This will show details of Job2 i.e. the time at which it got built.

Now, we will be building a Jenkins Pipeline to show Continuous Delivery.

Step 13: Now go to Jenkins homepage by clicking on Jenkins. 

Step 14: Click on “+” to create a pipeline view.

Step 15: Name the view and check mark “Build Pipeline View” and Click on OK.

Step 16: Go to Pipeline Flow and add Job1 in Select Initial Job. Click on OK.

Step 17: Now Click on Job1.

Step 18: Then Click on Configure.

Step 19: Go to Post-build Actions and select Build other projects. Add Job2 in Projects to build and check mark the “Trigger only if the build is stable“. Click on Save.

Step 20: Now Click on Job2 and click on Configure.

Step 21: Go to Build Triggers -> Select Build after other projects are built. Add Job1 in Projects to watch label.

Step 22: Click on the pipeline1 view you created.

Step 23: Click on Run. Job1 will start building.

After building Job1, Job2 will automatically build itself.

So, this was all about the What Is Continuous Integration and its implementation using Jenkins.

Subscribe to our youtube channel to get new updates..!

Unlock the potential of Continuous Testing in DevOps. Gain expertise in quality assurance, accelerated delivery, and seamless collaboration for successful software development.
Got a question for us? Please mention it in the comments section and we will get back to you.
Upcoming Batches For DevOps Certification Training Course
Course NameDateDetails
DevOps Certification Training Course

Class Starts on 4th May,2024

4th May

SAT&SUN (Weekend Batch)
View Details
DevOps Certification Training Course

Class Starts on 18th May,2024

18th May

SAT&SUN (Weekend Batch)
View Details
DevOps Certification Training Course

Class Starts on 20th May,2024

20th May

MON-FRI (Weekday Batch)
View Details
BROWSE COURSES