What is Jenkins ?
Tags: jenkins, devops, softwaredevelopment, beginners
Published: 2024-02-26 11:49:52

**Before Jenkins**
Let's see one scenario, Developers write and submit code into a code repository and these developers write their own unit tests and test their code but the actual problem here is the commits submitted by different developers into code repository aren't consistent. Then the issues will come after deployment and there might be some bugs in code and things just aren't working the way it should be and it increases delays for the deployment.

And in the past what we have to do is we have to wait until the entire application was built and tested before we could even begin checking errors. So the actual process of delivering project was very slow.

**What is jenkins ?**
Jenkins is a continuous integration/continuous delivery tool which also test and deploy newly created commits. It is written in java programming language. It is used to implement CI/CD workflows called pipelines.

There are two ways to do continuous delivery :

1. one is through **nightly build** in which all the changes made to the code are build together and at night it will get run, operated and tested and new build would be created.
2. In **continuous integration build**, we can commit our changes into source code continuously there is no need to wait. And all the test cases and verification services will get executed while building the application so all the cycles for testing against the code is running every time. And this is the power that jenkins provides in the continuous integration.

**What is continuous integration ?**

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

Continuous integration refers to practice of automating the process of integrating code changes from multiple contributors into one single project. It also go ahead and check test cases if added and validates the code if test isn't passed the code get back to the developer and build got failed. So it basically helps developers not to break the build and also allows the developers not to run all the tests locally.

So the goal of continuous integration is that developers become able to deploy services faster with all the testing and customer able to get new code faster.

**Continuous integration tools**
Some of the CI/CD open source tools are :

- Jenkins
- Gitlab
- Travis CI 
- Bamboo
- BitBucket
- Gradle

**Jenkins architecture**
- Developers commit changes into code repository.
- The jenkins continuous delivery server checks the repository at a regular intervals and pulls latest changes.
- The build server builds the code in executable file. If build got failed, it got send to developers via alerts or any other way.
- Jenkins deploy the build application to test server. IF test got failed, developers are alerted.
- If the build get successful, the application is deployed on the production server.

**Jenkins Master-Slave architecture**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/18bhomcgddvi0pqq8aw0.jpg)
- Jenkins master distributes all its load to the slaves.
- Jenkins checks the code repository at a particular intervals for any changes made in the source code.
- Each build requires different testing environment which is not possible for single jenkins server so jenkins uses different slaves to perform testing and generate report for a build and send it to master.

**Jenkins pipeline**
A Jenkins pipeline is a way to define and automate a series of actions, or stages, in the software delivery process. It allows you to script and manage the entire build, test, and deployment process as code. 

**Summary**
Jenkins has provided framework to developers for deploying and testing applications faster and with easier way.