Jenkins Basics

Jenkins Basics

#90daysdevopschallenge

#day22

1.What is Jenkins?

Jenkins is an automation tool and it is an open-source server that allows developers to build, test, and deploy continuously of your application or software.

Jenkins is written in Java and runs in Java, to use this in your system, you have to install Java in your system.

To successfully achieve continuous integration in Jenkins, we used different types of plugins.

2. What is Plugins?

Plugins is a software program like GitHub used in Jenkins to achieve successful Continuous Installation.

3.Why do we use Plugins?

Jenkins already knows How to clone code from GitHub and run but to understand some other commands we need plugins.

4.History of Jenkins

In 2004, Kohsuke Kawaguchi, who was working as a JAVA developer in SUN Microsystem. He was getting tired of building, testing, and running pipelines daily to daily. So he developed a software called Hudson.

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

5.Architecture of Jenkins

The architecture of Jenkins is based on master and slave architecture.

a) Jenkins Master node

b) Jenkins Slave node

By default, there is always one master node present and one slave node. You can add multiple slave nodes by using IP and ssh.

Jenkins Master Node:

The main server in Jenkins is called the Master node. It always runs on port 8080. It provides a dashboard, by using a dashboard you can create jobs but for build & test use a slave node.

Jenkins slave node:

By default, one slave node is present on Jenkins. if you want you can add multiple slave nodes. Jenkins slave executes jobs that are assigned by Jenkins master and you can assign the job to a particular slave node or the slave can choose any job.

How Jenkins works? Jenkins Architecture Explained!!! - DevOpsSchool.com

How Jenkins Works:

a) First of all developers commit the changes of code on GitHub, after a particular time Jenkins continuously checks for the update (By default in every 5s).

b) Whenever there is a new commit Jenkins finds it. Jenkins saves the changes is called workspace and starts to build changes.

c) If there is any error related to building, Jenkins informs the team and stops it there.

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

e) If testing is successful, the Jenkins server notifies to associated team.

❄Tasks

1.Create a freestyle pipeline to print "Hello World!!

Step 1: Create an EC2 instance on AWS.

Step 2: Install Java on the EC2 instance.

sudo apt update
sudo apt install fontconfig openjdk-17-jre

Step 3: Install Jenkins on the EC2 Instance.

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

Step 4: Get Initial Password

Step 5: Access it on the browser by using the public IP address of your EC2 Instance.

http://<public-ip-address>:8080

Step 6: Create a new job on Jenkins

Step 7: Enter the Name of the job. As per the task choose "Freestyle project".

Step 8: Choose "Build Steps"

Step 9: Enter your command <echo "Hello World!">. Click on "Apply".

Step 10: Click on "Build Now".

Step 11: Successfully Run

In the Next Article, we will read more about Jenkins......

Thank you for giving your precious time to read this blog/article and if any suggestions or improvements are required on my blogs feel free to connect on LinkedIn Unnati Gupta. Happy Learning !!!