ALL You Need To Know About Jenkins
Harsh Goenka
Associate Cloud Architect at Cloudside | AWS Certified Solution Architect | Certified Kubernetes Administrator | 2 x RedHat Certified | 5 x GCP Certified | AWS Community Builder | Technical Content Creator @Medium
Continuous Integration & Continuous Delivery are integral parts of DevOps, as they are used for integrating multiple stages of the methodology. There are many CI/CD tools in the market but Jenkins; the Java-based open-source CI/CD tool tops the popularity list, leading up to the occasional query of ‘What is Jenkins?’
What Is Jenkins?
Jenkins is an open-source server that is written entirely in Java. It lets you execute a series of actions to achieve the continuous integration process, that too in an automated fashion.
This CI server runs in servlet containers such as Apache Tomcat. Jenkins facilitates?continuous integration and continuous delivery?in software projects by automating parts related to build, test, and deployment. This makes it easy for developers to continuously work on the betterment of the product by integrating changes to the project.
Jenkins automates the software builds in a continuous manner and lets the developers know about the errors at an early stage. A strong Jenkins community is one of the prime reasons for its popularity. Jenkins is not only extensible but also has a thriving plugin ecosystem.
Some of the possible steps that can be performed using Jenkins are:
At the time of what is Jenkins blog, it had close to 1500+ plugins contributed by the community. Plugins help in customizing the experience with Jenkins, along with providing support for accelerating activities related to building, deploying, and automating a project.
Salient Features Of Jenkins
Jenkins is more functionality-driven rather than UI-driven hence, there is a learning curve involved in getting to know what is Jenkins. Here are the powerful developer-centric features offered by Jenkins:
1. Easy Installation & Configuration
Jenkins is a self-contained Java program that is agnostic of the platform on which it is installed. It is available for almost all the popular operating systems such as Windows, different flavors of Unix, and Mac OS.
It is available as a normal installer, as well as a .war file. Once installed, it is easy to configure using its web interface.
2. Open-Source
As it is open-source, it is free for use. There is a strong involvement of the community which makes it a powerful CI/CD tool. You can take support from the Jenkins community, whether it is for extensibility, support, documentation, or any other feature related to Jenkins.
3. Thriving Plugin Ecosystem
The backbone of Jenkins is the community and the community members have been instrumental in the development (and testing) of close to 1500+ plugins available in the Update Center.
4. Easy Distribution
Jenkins is designed in such a manner that makes it relatively easy to distribute work across multiple machines and platforms for accelerated build, testing, and deployment.
Master- Agent Architecture In Jenkins
The master-agent (or distributed) architecture in Jenkins is used for managing distributed builds. The Master and Agent(s) communicate through the TCP/IP protocol.
These are the roles and responsibilities of the Jenkins Master and Agent(s):
Jenkins Master
The main server in Jenkins is the Master. Here are the jobs handled by Jenkins Master:
The Jenkins master can also execute the jobs directly but it is always recommended to select the appropriate agent(s) for build and execution-related tasks.
Jenkins Agent(s)
A agent is a remote machine that is connected to the Master. Depending on the project and build requirements, you could opt for ’N’ number of agents. agents can run on different operating systems and depending on the ‘type of build request’, the appropriate Agent is chosen by the Master for build execution and testing.
Here are the jobs handled by the Jenkins Agent(s):
Here is a simple diagrammatic representation of how does Jenkins work, with multiple Jenkins Agents connected to the Jenkins Master:
Jenkins use cases
Let’s take a look at some of the main scenarios Jenkins plays a critical part in.
Continuous Integration (CI)
Continuous integration is a practice that forces developers to frequently integrate their code into a central repository. Instead of building out new features to the end without any quality measurement, every change is tested against the central repository in order to anticipate errors.
Every developer commits daily to a shared mainline and every commit triggers an automated process to build and test. If building or testing fails it can be detected and fixed within minutes without compromising the whole structure, workflow, and project. In that way, it is possible to isolate problems, solving them faster and provide higher-quality products.
Continuous Delivery (CD)
Continuous delivery is the ability to make changes of all types — such as new features, configuration changes, error fixes, experiments — into production in a safe and efficient manner using short work cycles.
The main goal in continuous delivery is to make deployments predictable as routine activities that can be achieved upon request. To be successful, the code needs to always be in a deployable state even when there is a scenario with lots of developers working and making changes on a daily basis. All of the code progress and changes are delivered in a nonstop way with high quality and low risks. The end result is one or more artifacts that can be deployed to production.
Continuous Deployment (CD)
Continuous deployment, also known as continuous implementation, is an advanced stage of continuous delivery that the automation process does not end at the delivery stage. In this methodology, every change that is validated at the automatic testing stage is later implemented at the production stage.
The?fail fast?strategy is always of the utmost importance when deploying to production. Since every change is deployed to production, it is possible to identify edge cases and unexpected behaviors that would be very hard to identify with automated tests. To fully take advantage of?continuous deployment, it is important to have solid logging technology that allows you to identify the increasing error count on newer versions. In addition, a trustworthy orchestration technology like?Kubernetes?that will allow the new version to slowly be deployed to users until the full rollout or an incident is detected and the version is canceled.
Automation
As a job executor, Jenkins can be used to automate repetitive tasks like backup/restore databases, turn on or turn off machines, collect statistics about a service and other tasks. Since every job can be scheduled, repetitive tasks can have a desired time interval (like once a day, once a week, every fifth day of the month, and so forth).
Conclusion
Integration solutions are a key step towards reaching delivery reliability. Every developer commits daily to a shared mainline and every commit triggers an automated workflow for building and testing; if building and testing fail it is possible to repair what is wrong quickly and safely and thereby increase productivity in the workflow. When we have a way to find problems and solve them quickly, we release higher-quality products and more stable experiences to the client.