How Continuous Integration Works with Jenkins

Jenkins is one of the devops and open source automation tool written in Java with plugins built for Continuous Integration purpose.

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.

It also supports version control tools and it is cross-platform and can be used on Windows, Linux, Mac, Solaris.

How Jenkins works

  • Jenkins triggers a build for every change made in the source code repository for example Git repository.
  • Once the code is built it deploys it on the test server for testing(selenium).Concerned teams are constantly notified about build and test results.If the results are ok(verified by concerned team) then the software is ready to release to production server.
  • Finally, Jenkins deploys the build application on the production server(docker).Continous Deployment is a manual step since it is business decision.

Now why Jenkins is used:

  1. Jenkin is an open source tool with great support.
  2. It is Easy to install.
  3. It has more than 900+ plugins to ease work.
  4. Its portable on all major platforms since built on Java.

Advantages of jenkins :

  1. It is open source and it is user-friendly, easy to install and does not require additional installations or components.
  2. It is available free of cost.
  3. Easily Configurable. Jenkins can be easily modified and extended. It deploys code instantly, generates test reports. Jenkins can be configured according to the requirements for continuous integrations and continuous delivery.
  4. Platform Independent. Jenkins is available for all platforms and different operating systems, whether OS X, Windows or Linux.
  5. Rich Plugin ecosystem. The extensive pool of plugins makes Jenkins flexible and allows building, deploying and automating across various platforms.
  6. Easy support. Because it is open source and widely used, there is no shortage of support from large online communities of agile teams.
  7. Developers write the tests to detect the errors of their code as soon as possible. So the developers don’t waste time on large-scale error-ridden integrations.
  8. Issues are detected and resolved almost right away which keeps the software in a state where it can be released at any time safely.
  9. Most of the integration work is automated. Hence fewer integration issues. This saves both time and money over the lifespan of a project.

Continuous Integration :

Let us imagine a scenario where the complete source code of the application was built and then deployed on a test server for testing:

Step 1 : First, a developer commits the code to the source code repository.

Step 2 : Meanwhile, the Jenkins server checks the repository at regular intervals for changes.

Step 3 : Soon after a commit occurs, the Jenkins server detects the changes that have occurred in the source code repository.

Step 4 : Jenkins will pull those changes and will start preparing a new build.

Step 5 : If the build fails, then the pertinent team will be notified.

Step 6 : If the build is successful, then Jenkins deploys the build in the test server.

Step 7 : You could configure the pipeline (the script to run) to create the build with several steps:

Step 8 : Prepare, test (unit and integration tests), package, publish, deploy.

Step 9 : After running it, Jenkins generates a feedback, if these constraints are ok, the artifact is valid ( artifact is a source code compiled for testing, find more info here). And then Jenkins notifies the developers about the build and test results.

Step 10 : Jenkins will continue to check the source code repository for further changes made in the source code, and the whole process will keep on repeating (functional tests).

Jenkins Tutorial  and documentaton: 

https://www.youtube.com/watch?v=…

https://jenkins-ci.org/