What is Continuous Integration (CI)
Tags: ci, devops
Published: 2022-11-19 13:24:12

WORKING in a team, all the code can be put in a central version control system like GitHub.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/33k8nzxv4b7d7zv567yb.png)

Developers will pull and push cods\es regularly.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z57cc9j9o1bifb6f2otk.png)
Every day there will be code pushes and pulls. Thus code updates regularly.
This code will be moved to build server and there it will be build, tested and evaluated.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xaoueog0995vhq2bhtc7.png)


Thus our software will be created and will be saved in a Artifact repository.This is generated from the build process.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jadqd87mz1md61tooad.png)
 
This artifact will be packaged in a specific format.
It is War/jar for Java.DLL/EXE/MSI in windows. Moreover, it can be in ZIP or tar.

Then it has to be shifted from repository to the servers.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dapt4i7g6eeowvz4w9hm.png)

After deploying this artifact into the servers, testers can run testing.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ufudwukmvpc5hsp2bm16.png)

Once it is approved, it is shipped to production servers.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z947u1w9ws96sk40wt4s.png)

So, that's how it works.

But lets see what problem arises in this cycle.
After the coders complete coding , they push it to GitHub.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcorlru0s5lik1urz738.png)

Assuming they have coded for 3 weeks and now need rest.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b60ntsb672ueheihcfc1.png)
Now all of the codes will go to the build servers.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60h4jdpaiir0yxzzi1sl.png)
Now this code is build and tested and oh boy!!!
Lots of errors.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgrq3kp4ckca19xireui.png)


Thus developers team need to fix all of these  issues.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vn5xdciklkwp79vs8b1r.png)

This could have been resolved if the problem was detected very early in the process.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8dqfsqjk9tf5ibbfald.png)

The developers could get notify when the error occurs and could code accordingly . But it was not detected.


Thus what could be the solution?
After every commit by the coders, the code should be build and tested. Right? Thus finding issue or error would be easier and a developer can easily solve it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5rok47gecjao8vjxji7v.png)

As developers will build and test multiple times a day, it is manually impossible or tiresome. Thus, automate it!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gd1evhk8m36je0mlor5v.png)



So, when a developer commits any code it will automatically go to the server and get build and tested.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i600twyvh3fd0r1aicpi.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9amer8vjdt0t7ed20od5.png)
It will then send a notification if there is a failure.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvo3hduz4gmx1gsfgq0d.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6bpi7a2uusgr35fsl5fv.png)

As soon as the developer finds and issue,he/she will resolve it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ext0x6oa0gljy204rrhp.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9qqqdn9e8ekipgcdrvd.png)

He/ she will commit again fixing the issue.
Again it will go to the servers and build and test will be run. It  found no issue, it will be stored in the software repository.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v6lj9xpzcctcq1agczw2.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tzp9pn67puu00ut6emu.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qg4wenv4fwhz2rljjnhv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydxqb5sh6abdbk7q3awm.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/32d6aqldimtnngeznlfv.png)

Done!
Therefore, after a successful testing , it will automatically go through all other steps we previously mentioned.

Let's see a cyclic view.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7fia0yz2jq3m9grqwdxw.png)
This is called Continuous Integration.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccooe643sc5tku3687uq.png)



The goal of CI is to detect issues in a very early stage.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pd7h0hl9c93p5ixm2kh9.png)

So, this is what happens using Jenkins as our CI tool.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lt1g6qqf8fcqaaej56ym.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zxhd9dr3oqdux3xb8kpq.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6sgnhmp330mrr6cs67j8.png)




So, these are the tools used:
1. IDE.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aramjd5851sv01mp4vv9.png)
2. Integrated with a version control system.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fx6yqg442j4yi39azhwu.png)
3. Build tools based on the programming languages.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hsvrjz6pm96frk3wbjor.png)

4. Software repositories to store artifacts.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kdz3gujq701t6vz5uulb.png)


5. CI Tools that integrates everything.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kp1g3wenqcvx911mna7.png)


That's it.
<img src="https://media0.giphy.com/media/Nfs5y1kzJKfu/giphy.gif?cid=ecf05e472d3w835ptrri5m1p6ifnwl9mi7ope9pifvhpcxf6&rid=giphy.gif&ct=g">