Introduction to Jenkins

Introduction to Jenkins

So continuing our journey and moving one step forward, In this blog we will understand and learn about Jenkins.

In previous blogs, we understood and completed some hands-on practicals on Kubernetes. You can check out the previous blogs here - Previous Blogs

What is Jenkins?

Jenkins is one of the most popular tools DevOps tools, originally designed with one purpose in mind: to be a great build automation server.

It is an open-source automation tool written in Java programming language that allows continuous integration.

Jenkins offers a straightforward way to set up a continuous integration or continuous delivery environment for almost any combination of languages and source code repositories using pipelines, as well as automating other routine development tasks.

Jenkins achieves CI (Continuous Integration) with the help of plugins. Plugins are used to allow the integration of various DevOps stages.

What is CI/CD?

Continuous Integration (CI) is an approach to testing each change to the codebase automatically, whereas Continuous Delivery (CD) is an approach to obtain changes of new features, configuration, and bug fixes.

Continuous Integration is a process of integrating code changes from multiple developers in a single project many times. The software is tested immediately after a code commit. With each code commit, code is built and tested. If the test is passed, the build is tested for deployment. If the deployment is successful, the code is pushed to production.

This commit, build, test, and deploy is a continuous process hence the name continuous integration/deployment.

Tools used for the CI process are Jenkins, Bamboo, TeamCity, and many more.

History of Jenkins

  • Kohsuke Kawaguchi, a Java developer, working at SUN Microsystems, was tired of building the code and fixing errors repetitively. In 2004, created an automation server called Hudson that automates build and test tasks.

  • In 2011, Oracle who owned Sun Microsystems had a dispute with Hudson open source community, so they forked Hudson and renamed it as Jenkins.

  • Both Hudson and Jenkins continued to operate independently. But in a short period, Jenkins acquired a lot of projects and contributors while Hudson remained with only 32 projects. With time, Jenkins became more popular, and Hudson was not maintained anymore.

Working of Jenkins

  • First of all, a developer commits the code to the source code repository (CVS, SVN, GIT, Mercurial, Perforce, ClearCase). Meanwhile, the Jenkins checks the repository at regular intervals for changes.

  • Soon after a commit occurs, the Jenkins server finds the changes that have occurred in the source code repository. Jenkins will draw those changes and will start preparing a new build.

  • If the build fails, then the concerned team will be notified.

  • If the build is successful, then the Jenkins server deploys the built-in test server.

  • After testing, the Jenkins server generates feedback and then notifies the developers about the build and test results.

  • It will continue to verify the source code repository for changes made in the source code and the whole process keeps on repeating.

Advantages & Disadvantages of Jenkins

Advantages of JenkinsDisadvantages of Jenkins
It is an open source & a free-of-cost tool.Not easy to maintain it because it runs on a server and requires some skills as a server administrator to monitor its activity.
It does not require additional installations or components. This means it is easy to install.CI regularly breaks due to some small setting changes. CI will be paused and therefore requires some developer's team attention.
It is built in Java and hence it is portable.Its interface is outdated and not user-friendly compared to current user interface trends.

Use Cases of Jenkins

  • Deploying code into production

  • Enabling task automation

  • Reducing the time it takes to review a code

  • Driving continuous integration

  • Enhancing coding efficiency

Important Terms & Terminologies in Jenkins

  • Node: In Jenkins, a node is a machine that is capable of executing Pipelines or Projects. Both the Controller and Agents are considered to be Nodes.

  • Jenkins Controller (formerly called a Master): The basic installation of Jenkins operating along is called a “master” or “controller.” The controller handles all tasks for your build system in this configuration. The Jenkins controller schedules projects, assigns agents/nodes, and sends builds to agents to execute projects. The controller will also monitor the agent state (offline or online), receive build result responses, and display build results on the console output.

  • Agent (formerly called a Slave): The Jenkins controller is the original node in the Jenkins installation. The Jenkins controller controls the Jenkins agents and orchestrates their work, including scheduling projects on agents and monitoring agents. Agents may be connected to the Jenkins controller either locally or via the cloud.

  • Plugin: Jenkins has over 1,700 plugins that extend its functionality. You can browse the full plugins library, and plugins can be easily added through the Jenkins dashboard. Plugin functions range from adding source code management (SCM) to automating build agents using Kubernetes to even creating custom dashboard views.

  • Project (formerly called a Job): A project can be considered as a particular automated task to achieve a required objective in Jenkins. Users can create and build these projects to test applications.

    There are 5 different projects available in Jenkins:

    • Freestyle Project

    • Pipeline Project

    • Maven Project

    • Multi-configuration Project

    • Folder

  • Jenkinsfile: A text file that contains the definition of a Jenkins Pipeline and is checked into source control. A Jenkinsfile can be written using two types of syntax: Declarative and Scripted, which are constructed fundamentally differently.

  • Artifacts: Artifacts can be used to represent data created as a side-effect of running a Jenkins build. Artifact files are associated with a single build. A build can have any number of artifacts associated with it.

  • Groovy: Apache Groovy is a powerful, multi-faceted language for the Java platform. It can be used to orchestrate your pipeline in Jenkins and it can glue different languages together. Groovy can also be used as one of the scripting languages for the Java platform.

Conclusion

So let's conclude this blog where we understood and learned about the introduction to Jenkins, its history, and some basic terms and terminologies used in the working of Jenkins.

In the next blog, we will go through the installation of Jenkins in the Ubuntu System.

So, stay updated and subscribe to my hashnode channel. 🙌


Thankyou & Happy Learning !! 🚀