INTRODUCTION TO JENKINS:
Jenkin is a Continuous Integration Tool, Now that we have understood what is Continuous Integration?
WHAT IS CONTINUOUS INTEGRATION?
There are a team of Developers who are working. Let’s say Developer 1, Developer2, Developer3 and so on and they are all developing the code. So, in a process of Continuous Development every Developer will be writing the code as well as the code which ever written will go for Testing as soon as possible. So, let’s suppose the Team of Developers who are writing code and whenever they write the code, they are placing the code in a Version Control System let’s say Gig. And from the local repository it was pushed to remote repository say GitLab.
So once code is available on GitLab, let’s say a new comment, a new change happened. So, these new changes should be sensed by the system which will pull the code and build it. Meanwhile there should be a system which can sense this new change. Means whenever Developers make any new code change that should be sensibly system, pull the new code and build it, that’s called Continuous Builds. And this Continuous Builds will be happening through Build Automation Tool like Maven or Ant or Graddle and so on. And so, there are so many Build Automation Tools depending on the technology of your application.
Let’s say Developers are writing the code in Java, so Java code can be build using Maven and Graddle. Let’s suppose Developers are developing here in Dotnet Code. So, there will be different Build Automation Tools Like an Ant, Microsoft Build Engine and so on for Dotnet. So, depending on the technology in which they have written the code. So, there is a corresponding Build Automation Tool which will build the code.
So, what is meant by Building the Code? Building the code is nothing but compiling the code. And then packaging the code and this is called Building. Compiling means again converting the source code into executable code is called Compiling the code. Whereas Packaging is converting all your executable coding into a single ready to deployable file. So that’s called Build. So once code is ready whenever any new changes are done to the code, it will be pulled and build. So, if a build is success means, no build errors it will proceed further.
What is Build failed? Build failed means some runtime errors it could not successfully compile the code, so many reasons tag errors, run time errors and so on. So whenever Build failed it should be informed to Development Team and they will make the changes, fix it again , push the code to the Version Control System from where means , see they made that changes which is pushed to Version Control System which is again pulled and Build and so this process repeats till Build is passed. No Compilation errors, no run time errors. So once Build passed, it will pass through next phase called Continuous Testing. So once Build is done, like once Build is successfully the will be deployed to test environment and then tested because see here in this Continuous Builds code is compiled and packaged , means deployable file is ready, so which should be deployed first to to some test environment and it would be tested . And it should be tested again by using some Automation Testing Tools like Selenium, Junit and so on. And these test cases will be written by Automation Testers.
Once these test cases are executed and once application is tested, if there are any bugs like suppose any bugs are identified and so whenever bug is identified, it will be again reported to Development Team who will fix it. Fix it means again changes to code, so whenever they make any changes to the code means they made some comments to this Version Control System. So, from where again it would be pulled and Build. So, this process repeats. And suppose Testing passed, there are no bugs, everything is good, it is defect free. Then it would be deployed to some other environments and so on till it reaches protection. So, every change made here, every new comment made by Developer goes through this process. Means whenever Developers make new change it will go through the Build process, Test process and then once Testing is successful on the Test environment it would be deployed to other environments like Staging, Prepod and everything before it goes to production. So, this process of Continuous Development, Continuous Building, Continuous Testing is called Continuous Integration.
And once it was working fine it could be deployed to different environments and also to the next and then the production. This is called Continuous Deployment. Continuous Deployment is a term where, whenever a need, a change is made it could hit the Production Servers automatically by going through all these phases. That’s called Continuous Deployment which is called Continuous Delivery. It looks and sounds similar, but Continuous Delivery is a safer method where in the whole process remain same and it would be deployed to different environments and it would be deployed to production after manual approval, that’s called Continuous Delivery.
Means in Continuous Delivery, we can decide which release (or) which version (or)which changes are going to production we can have a control on which goes to the production whereas in Continuous Deployment only new change will go through all the process automatically and then to production. So that’s called Continuous Deployment and that’s a slight difference between Continuous Deployment and Delivery. But these works are used in interchangeable in real time and this is actual difference between them. So, in Devops methodology Continuous Delivery is also possible. And here come the tools called Continuous Integration Tools called Jenkins, and through Jenkins we can execute these phases of Deployment, Build, Testing and Deployment.
So, Jenkins is a tool through which we can execute all these phases. So, for Building you are using Build Automation Tools like Maven and Version Control System comes in where Developers push the code and Continuous Testing Tools like Selenium and so on and for Deployment, we can use Docker, Ansible and so on. So that way all these Devops Tools come in. And we are going to implement this practically in our course.
INTRODUCTION TO JENKINS:
Now that we have understood what is Continuous Integration. Let’s see what Jenkins is. Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing and delivering or deploying the software. This can be called as an Orchestrator, which can be integrated with different tools and help us to achieve the delivery part in devops. So, it can be helpful in executing different phases in our project like building, testing, deploying and so on using the respective tools. And there are many other tools under this category which helps us to achieve continuous integration. Some of them are Jenkins, Bamboo, Travis CI Buildbot, GitlabCI and so on. But Jenkins is more widely used and most famous because of the features it has got. Let us see the important features of Jenkins
FEATURES OF JENKINS:
1.EASY TO SET UP: It is very easy to set up and install Jenkins. Jenkins is basically a Java based application. Meaning we need to have JRE running on the machine to work with Jenkins. So it is quite easy to setup and it works on multiple operating systems like windows, mac, Linux and so on.
2.EASY TO CONFIGURE: It is easy to configure. It is very easy to configure and create Jenkins job because it has got a great web interface through which you can create the jobs, you can identify the errors in the builds on the fly. Also it has got hundreds of plugins.
3.PLUGINS: Plugin are very important in Jenkins. They enhance or improve the functionality of Jenkins. If you need any functionality or if you need Jenkins to integrate with any other tool, we need a plugin. So, plugins play an important role which will extend and enhance the functionality of Jenkins, thereby help us in achieving continuous integration and continuous delivery process.
4. EXTENSIBLE: It is extensible, Jenkins can be extended because of its plugin architecture, so providing lot of functionalities. So hence it is extendable and distributed . DISTRIBUTED: Jenkin have got distributed architecture because we are running different jobs like build, test and so on. These jobs can execute on multiple machines. It can be executed on multiple environments. So, this is possible because of this distributed nature and through master’s life concept in Jenkins. We are going to see those master’s life concept adding mode to Jenkins.