Day 22 : Getting Started with Jenkins

Radheya Zunjur
6 min readJul 7, 2023

--

Day 22 of our comprehensive guide is dedicated to helping you get started with Jenkins. We will explore the fundamental concepts, installation process, and basic configurations that will enable you to leverage the power of Jenkins within your development environment.

Jenkins, an open-source automation server, allows teams to automate their build, test, and deployment processes. It provides a robust and extensible platform that integrates with various tools and technologies, making it a popular choice among software development teams worldwide.

What is Jenkins?

- Jenkins is an open source continuous integration-continuous delivery and deployment (CI/CD) automation software DevOps tool written in the Java programming language. It is used to implement CI/CD workflows, called pipelines.

- Jenkins is a tool that is used for automation, and it is an open-source server that allows all the developers to build, test and deploy software. It works or runs on java as it is written in java. By using Jenkins we can make a continuous integration of projects(jobs) or end-to-endpoint automation.

-Jenkins achieves Continuous Integration with the help of plugins. Plugins allow the integration of Various DevOps stages. If you want to integrate a particular tool, you need to install the plugins for that tool. For example Git, Maven 2 project, Amazon EC2, HTML publisher etc.

Explain Jenkins Architecture

Jenkins follows a distributed architecture model that consists of several components working together to automate various stages of the software development lifecycle. Let’s explore the key components and their roles in the Jenkins architecture:

1. Jenkins Master: The Jenkins Master is the central control hub of the Jenkins architecture. It manages the automation process and coordinates the activities of other components. The Master is responsible for scheduling and distributing build jobs to the connected build agents, monitoring their execution, and collecting build information and logs.

2. Jenkins Agents (or Slaves): Jenkins Agents, also known as Jenkins Slaves, are the worker nodes that execute build jobs on behalf of the Jenkins Master. Agents can be located on the same machine as the Master or distributed across multiple machines to allow for scalability and parallel processing. They are responsible for executing tasks such as checking out source code, building software, running tests, and deploying applications.

3. Executors: Executors are the execution threads running on Jenkins Agents. Each Executor can run a build job or a task in parallel. Executors enable concurrent execution of multiple build jobs, improving overall performance and reducing build times.

4. Jobs: Jobs in Jenkins define the individual tasks or workflows to be executed. A job typically represents a specific build process, such as compiling source code, running tests, or deploying an application. Jobs are created and configured using Jenkins’ web-based interface or by defining a Jenkinsfile, which is a Groovy-based script that defines the build steps and configurations.

5. Plugins: Plugins are extensions to Jenkins that enhance its functionality and enable integration with various tools, technologies, and platforms. Jenkins has a vast ecosystem of plugins that can be installed to extend its capabilities for source code management, build tools, testing frameworks, deployment tools, and more. Plugins allow customization and integration with external systems, making Jenkins highly adaptable to different DevOps workflows.

6. Distributed File System: Jenkins utilizes a distributed file system to store configurations, job definitions, build artifacts, and other related files. This file system ensures that the Jenkins Master and Agents can access and share necessary files, enabling seamless collaboration and build execution.

7. Web-based User Interface (UI): Jenkins provides a user-friendly web interface that allows users to manage and configure jobs, view build history and logs, and access various administrative functions. The UI provides a centralized control panel for managing the Jenkins environment and monitoring the progress of build jobs.

Why Jenkins is important for DevOps Engineer?

Jenkins is a widely used and popular open-source automation server that is highly valuable for DevOps engineers. Here are some reasons why Jenkins is useful in a DevOps environment:

1. Continuous Integration and Delivery (CI/CD): Jenkins provides a robust platform for implementing CI/CD pipelines. It enables teams to automate the building, testing, and deployment of software applications, ensuring faster and more reliable delivery cycles. With Jenkins, developers can commit code changes, triggering automated processes that build and deploy the application, run tests, and generate reports.

2. Extensibility and Plugin Ecosystem: Jenkins offers a vast array of plugins that enhance its functionality. These plugins enable integration with various development, testing, and deployment tools and technologies, allowing for seamless automation across the entire software delivery lifecycle. DevOps engineers can easily extend Jenkins’ capabilities to fit their specific requirements and integrate it into their existing toolchain.

3. Scalability and Distributed Builds: Jenkins supports distributed builds, enabling DevOps teams to scale their build infrastructure efficiently. It allows for the distribution of build workloads across multiple nodes, allowing parallel processing and faster build times. This scalability feature is particularly valuable when dealing with large projects or when there is a need to handle multiple concurrent builds.

4. Monitoring and Notifications: Jenkins provides comprehensive monitoring and reporting capabilities. It allows DevOps engineers to track the status and progress of builds, tests, and deployments in real-time. Jenkins can generate detailed reports, including test results, code coverage, and build trends, helping teams identify issues quickly and make data-driven decisions. It also supports notifications through email, instant messaging, or other channels to keep team members informed about build status or failures.

5. Infrastructure as Code (IaC) Support: Jenkins can integrate with infrastructure provisioning and configuration management tools such as Ansible, Chef, or Puppet. This integration allows for the automation of infrastructure deployment, making it easier to manage and version infrastructure as code. DevOps engineers can define and deploy infrastructure changes alongside their application code, ensuring consistency and reproducibility.

6. Community Support and Active Development: Jenkins has a large and active community of users and contributors. This means that there is a wealth of documentation, tutorials, and resources available for learning and troubleshooting. The community regularly develops new plugins and updates existing ones, ensuring that Jenkins keeps up with evolving technologies and practices in the DevOps space.

Tasks :

Task 1 ) Install Docker and Run it.

Step A) Run the following commands. Install Java: Jenkins requires Java to run, so the first step is to install Java on the Ubuntu instance. You can do this by running the following command:

sudo apt-get update
sudo apt-get install openjdk-11-jdk

Step B) Add Jenkins repository: Next, you need to add the Jenkins repository to the instance by running the following commands:

sudo curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
sudo echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null

Step C ) Install Jenkins: Now you can install Jenkins by running the following command:

sudo apt-get update
sudo apt-get install jenkins

Step D) Start Jenkins: Once Jenkins is installed, start & enable the Jenkins service using the following command:

sudo systemctl start jenkins
sudo systemctl status jenkins
sudo systemctl enable jenkins
Jenkins is up and running

Task 2) Create a freestyle pipeline to print “Hello World”

Step A) Open Jenkins in web browser > click on “New Item”

Step B ) Select FreeStyle Project > Enter the Github Repo URL

Step C) Build the project and see the output

This was the first article of Jenkins and we have successfully installed Jenkins and configured our first project. Stay tunned for the next article!

--

--

Radheya Zunjur
Radheya Zunjur

Written by Radheya Zunjur

Database Engineer At Harbinger | DevOps | Cloud Ops | Technical Writer

No responses yet