0% found this document useful (0 votes)
4 views

Devops Module2

The document outlines a course on Introduction to DevOps, focusing on Continuous Integration (CI) and Continuous Deployment (CD) using Jenkins. It covers Jenkins architecture, managing nodes, and creating CI/CD pipelines, emphasizing the automation of build, test, and deployment processes. Key tools and integrations with DevOps practices are also discussed, providing a comprehensive overview of CI/CD workflows.

Uploaded by

keshavareddy2468
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Devops Module2

The document outlines a course on Introduction to DevOps, focusing on Continuous Integration (CI) and Continuous Deployment (CD) using Jenkins. It covers Jenkins architecture, managing nodes, and creating CI/CD pipelines, emphasizing the automation of build, test, and deployment processes. Key tools and integrations with DevOps practices are also discussed, providing a comprehensive overview of CI/CD workflows.

Uploaded by

keshavareddy2468
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Course: Introduction to DevOps (CSA1007)

Dr.Mohana S D,
Assistant Professor,
(Course Instructor Incharge - CSA1007)
School of Information Science,
Presidency University Bengaluru.
Main Topic

Modules
1 Introduction To Continuous Integration

2 Jenkins Architecture
3 Managing Nodes On Jenkins
4 Jenkins Master Node Connection
5 Jenkins Integration With Devops Tools
6 Understanding CI/CD Pipelines
7 Creating A CI/CD Pipeline

CSA2020 Introduction to DevOps 1 / 29


Introduction To Continuous Integration

Introduction To Continuous Integration

Continuous Integration (CI) is a software development practice where


developers frequently integrate their code into a shared repository,
usually multiple times a day.
Each integration is verified through an automated build and test
process to detect errors early.

Popular CI Tools
Jenkins – Open-source CI/CD automation tool.
GitHub Actions – CI/CD directly integrated with GitHub.

CSA2020 Introduction to DevOps 2 / 29


Introduction To Continuous Integration

CI Workflow

Developer pushes code to VCS (e.g., GitHub).


CI server (e.g., Jenkins, GitHub Actions, GitLab CI/CD) detects
changes.
CI server runs build and test scripts automatically.
Results are reported (pass/fail).
If tests pass, code is merged; otherwise, developers fix errors.

CSA2020 Introduction to DevOps 3 / 29


Introduction To Continuous Integration

CI/CD pipeline
CI And CD (Continuous Deployment/Delivery)

Figure: CI/CD pipeline

CSA2020 Introduction to DevOps 4 / 29


Introduction To Continuous Integration

CI vs. CD (Continuous Deployment/Delivery)

1 Continuous Integration (CI) – Merges code and runs tests


automatically.
2 Continuous Delivery (CD) – Automates code deployment after CI
(manual approval needed).
3 Continuous Deployment – Deploys every change automatically if tests
pass.

CSA2020 Introduction to DevOps 5 / 29


Introduction To Continuous Integration

Continuous Integration (CI) Pipeline in Jenkins

1 A Continuous Integration (CI) pipeline is an automated process that


builds, tests, and validates code changes before merging them into
the main branch.
2 Jenkins automates this process using Jobs, Pipelines, and Plugins.
3 Jenkins plays a crucial role in Continuous Integration (CI) and
Continuous Deployment (CD) by automating the build, test, and
deployment processes.
4 It enables developers to integrate code changes frequently, detect
errors early, and deploy software efficiently.

CSA2020 Introduction to DevOps 6 / 29


Jenkins Architecture

Jenkins Architecture

Jenkins follows a Master-Agent architecture to distribute workloads


efficiently. This architecture ensures scalability, fault tolerance, and
optimized resource utilization..
Four main components of jenkins
1 Jenkins Master (Controller/server)
2 Jenkins Agent (Worker Nodes)
3 Build Executor
4 Job/Build and Queue

CSA2020 Introduction to DevOps 7 / 29


Jenkins Architecture

Jenkins Architecture

CSA2020 Introduction to DevOps 8 / 29


Jenkins Architecture

Four main components of jenkins

1.Jenkins Master (Controller): The core component responsible for


1 Job Scheduling – Assigning build tasks to agents.
2 User Interface – Provides a web-based dashboard for users.
3 Plugin Management – Supports a wide range of integrations.
4 Build Management – Stores configurations and logs.
5 Queue Management – Organizes build requests.

CSA2020 Introduction to DevOps 9 / 29


Jenkins Architecture

Four main components of jenkins

2.Jenkins Agent (Worker Nodes)


1 Agents execute build tasks assigned by the master.
2 Can be static (always available) or dynamic (created as needed).
3 Connects to the master via Jenkins Remoting (Java-based) or
SSH/WebSockets.
4 Allows parallel execution of jobs.

CSA2020 Introduction to DevOps 10 / 29


Jenkins Architecture

Four main components of jenkins

3. Build Executor
1 Each agent has multiple executors to run builds in parallel.

CSA2020 Introduction to DevOps 11 / 29


Jenkins Architecture

Four main components of jenkins

4. Job/Build and Queue


1 Represents a specific task, such as compiling, testing, or deploying an
application.
2 Stores pending jobs before they are assigned to agents.

CSA2020 Introduction to DevOps 12 / 29


Jenkins Architecture

Jenkins Distributed Architecture

Figure: Jenkins Distributed Architecture

CSA2020 Introduction to DevOps 13 / 29


Jenkins Architecture

Jenkins Master

The Jenkins Master is the central server responsible for:


1 Managing jobs and configurations
2 Scheduling builds and assigning tasks to agents
3 Providing the user interface (UI) for job monitoring
4 Processing plugin configurations
5 Storing build artifacts and logs

CSA2020 Introduction to DevOps 14 / 29


Jenkins Architecture

Jenkins Agent (Node/Slave)

The Jenkins Agent is a separate machine that executes tasks


assigned by the master. It handles:
1 Running build and test tasks
2 Executing shell commands and scripts
3 Distributing workload across multiple agents
4 Specialized execution environments (e.g., Windows, Linux, Docker)

CSA2020 Introduction to DevOps 15 / 29


Managing Nodes in Jenkins

Managing Nodes in Jenkins

Nodes (Agents) in Jenkins help distribute workload by offloading


tasks from the master.
Master (Controller Node) – Primary Jenkins instance, responsible for
job scheduling.
Agent (Worker Node) – Runs assigned builds.
Static Agents – Always available.
Dynamic Agents – Spawned when needed, e.g., using Kubernetes or
Docker.

CSA2020 Introduction to DevOps 16 / 29


Managing Nodes in Jenkins

Adding a New Node (Agent)

To set up an agent node in Jenkins:


1. Enable Security & Configure Nodes
Open Jenkins Dashboard – Navigate to Manage Jenkins – Manage
Nodes and Clouds.
Click on New Node, give it a name, and select Permanent Agent.

CSA2020 Introduction to DevOps 17 / 29


Managing Nodes in Jenkins

Adding a New Node (Agent)

To set up an agent node in Jenkins:


2. Configure Node Settings
Set the Number of Executors (defines parallel jobs).
Set Remote Root Directory (where Jenkins files will be stored).
Choose Launch Method:
SSH (for Linux/Mac).
JNLP (Java Web Start Agent) (for cross-platform).
Windows Service (for Windows agents).

CSA2020 Introduction to DevOps 18 / 29


Managing Nodes in Jenkins

Adding a New Node (Agent)

To set up an agent node in Jenkins:


3. Launch the Agent
SSH Connection: Jenkins connects via SSH and starts the agent.
JNLP Connection

4. Verify Node is Online


Check Manage Nodes and Clouds to confirm the agent is running.

CSA2020 Introduction to DevOps 19 / 29


Jenkins Master-Node Connection on Windows (Local Setup)

Jenkins Master-Node Connection on Windows (Local


Setup)

Prerequisites
Install Java (JDK 11) on both Master and Agent machines.
Install Jenkins on the Master machine (if not already installed).
Ensure Network Connectivity between Master and Agent.
Disable Windows Firewall (or allow Jenkins & Java through the
firewall).

CSA2020 Introduction to DevOps 20 / 29


Jenkins Master-Node Connection on Windows (Local Setup)

Jenkins Master-Node Connection on Windows (Local


Setup)

Step 1: Enable Agent Nodes in Jenkins (Master Configuration)


Open Jenkins Dashboard – Click on Manage Jenkins.
Go to Manage Nodes and Clouds – Click on New Node.
Enter a Node Name (e.g., Windows-Agent), select Permanent Agent,
and click OK.
Configure:
1 Remote Root Directory – C:JenkinsAgent
2 Number of Executors
3 Labels – Add relevant labels
4 Launch method – Select Launch agent via Java Web Start.
Click Save – The agent will be listed in the Nodes page.

CSA2020 Introduction to DevOps 21 / 29


Jenkins Master-Node Connection on Windows (Local Setup)

Jenkins Master-Node Connection on Windows (Local


Setup)

Step 2: Start the Jenkins Agent on the Windows Node


Open the Jenkins Node Configuration Page.
Copy the agent.jar download link from the page.
On the Windows Agent machine: Open Command Prompt (cmd) and
run (mkdir C:JenkinsAgent and cd C:JenkinsAgent)
Start the Agent using the Jenkins Web Start (JNLP) method

CSA2020 Introduction to DevOps 22 / 29


Jenkins Master-Node Connection on Windows (Local Setup)

Jenkins Master-Node Connection on Windows (Local


Setup)

Step 3: Verify the Node Connection


Go to Manage Jenkins 
Manage Nodes and Clouds.
check if the agent shows Connected.
Run a Test Job on the agent:
1 Create a New Job in Jenkins.
2 Set the Restrict where this project can be run option.
3 Enter the Windows node label (e.g., windows).
4 example: Add a simple build step: echo ”Hello from Windows Agent!”
5 Run the job and verify the output.
Click Save - The agent will be listed in the Nodes page.

CSA2020 Introduction to DevOps 23 / 29


Jenkins Integration with DevOps Tools

Table: Jenkins Integration with DevOps Tools

Category DevOps Tools


Version Control Git GitHub, GitLab, Bitbucket
Build Tools Maven, Gradle, Ant
Testing Frameworks JUnit, Selenium, PyTest, JMeter
Code Analysis SonarQube, Checkstyle, PMD
Artifact Management Nexus, JFrog Artifactory
Containerization Docker, Podman
Orchestration Kubernetes, OpenShift
Configuration Management Ansible, Puppet, Chef
Cloud Deployment AWS, Azure, Google Cloud
Monitoring Prometheus, Grafana, ELK Stack
Notifications Slack, Email, Microsoft Teams

CSA2020 Introduction to DevOps 24 / 29


Understanding CI/CD Pipelines

Creating a CI/CD Pipeline Using Git & GitHub with


Jenkins

A CI/CD pipeline automates the build, test, and deployment process.


Install & Configure Jenkins
Create a GitHub Repository
Define the Jenkins Pipeline
Configure Jenkins to Use GitHub
Run & Verify the Pipeline

CSA2020 Introduction to DevOps 25 / 29


Understanding CI/CD Pipelines

Creating a CI Pipeline Using Git & GitHub with Jenkins

1. Install & Configure Jenkins


Install Jenkins and required plugins:
Git Plugin (for GitHub integration)

Install & Configure Jenkins


Set up Git Credentials in Jenkins:
Manage Jenkins  Manage Credentials  Add GitHub Credentials.

CSA2020 Introduction to DevOps 26 / 29


Understanding CI/CD Pipelines

Creating a CI Pipeline Using Git & GitHub with Jenkins

2. Create a GitHub Repository


Go to GitHub  Create a new repo (e.g., ci-cd-pipeline).
Clone it to your local machine (using git repository)

CSA2020 Introduction to DevOps 27 / 29


Understanding CI/CD Pipelines

Creating a CI Pipeline Using Git & GitHub with Jenkins

3. Configure Jenkins to Use GitHub


Create a New Pipeline Job:
Jenkins Dashboard  New Item  Pipeline.
Name it CI-CD-Pipeline.
In Pipeline Definition, select Pipeline script from SCM.
Choose Git and enter the GitHub repo URL.
Set the branch to main and save.

CSA2020 Introduction to DevOps 28 / 29


Understanding CI/CD Pipelines

Creating a CI Pipeline Using Git & GitHub with Jenkins

4. Run & Verify the Pipeline


Trigger a Build in Jenkins.
Check the Console Output to see:
Code checkout
Build logs
Test execution
Deployment process
Access the Application at http://localhost:8080.

CSA2020 Introduction to DevOps 29 / 29

You might also like