Linux, Git, Git-Hub, and Docker are finished, so let's learn the key CI/CD tools to deploy them:
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.
Let us do discuss the necessity of this tool before going ahead to the procedural part for installation:
Nowadays, humans are becoming lazy😴 day by day so even having digital screens and just one click button in front of us then also needs some automation.
Here, I’m referring to that part of automation where we need not have to look upon a process(here called a job) for completion and after it do another job. For that, we have Jenkins with us.
Note: By now Jenkins should be installed on your machine(as it was a part of previous tasks, if not follow these steps ⬇️
Open your AWS account and create an instance and key pair like Jenkins.
After that, connect the SSH client to your local machine
After connecting, update your terminal
sudo apt-get update
.The important point is that when you want to install Jenkins, you first need to install Java
sudo apt install openjdk-17-jre
.After that, you can install Jenkins using this command:
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
After that, go to your AWS account, select your instance, go to security, click on security group, go to edit inbound rules and add rules port no. 8080 and anywhereipv4 and save the rule.
After that, go to Details and copy your IPv4 address. Open a new tab and copy that IPv4 address with port 8080 like this: ipv4:8080, and Jenkins will open.
Tasks🎈
What you understood in Jenkin, write a small article in your own words❓
Jenkins is a powerful open-source automation server that simplifies and streamlines various aspects of software development. It acts as a hub for automating tasks like building, testing, and deploying applications, and enhancing development workflows. With a user-friendly interface and an extensive collection of plugins, Jenkins enables teams to automate repetitive processes, integrate with version control systems, trigger builds on code changes, and ensure consistent software quality. This robust tool optimizes efficiency, minimizes manual errors, and accelerates the delivery of high-quality software, making it an essential asset for modern development pipelines.
Create a freestyle pipeline to print "Hello World!!"❓
Creating a simple freestyle pipeline in Jenkins involves creating a new Jenkins job and configuring it to execute a simple "Hello World!" print statement. Here's a step-by-step guide:
Log into Jenkins: Open your web browser and navigate to your Jenkins server's URL (e.g., http://ipv4:8080). Log in with your credentials.
Create a New Freestyle Job: Click on "New Item" on the Jenkins dashboard. Enter a name for your job (e.g., "HelloWorld") and select "Freestyle project." Click "OK" to proceed.
Configure the Job: You'll be taken to the job configuration page.
a. General: You can provide a brief description of the job.
b. Build: Click on "Add build step" and select "Execute shell" (for Linux/Unix) or "Execute Windows batch command" (for Windows).
c. Command: Enter the following command to print "Hello World!" to the console:
echo Hello World!!
Save and Run: Click "Save" to save your job configuration. You'll be redirected to the job's main page. You can then manually trigger the job by clicking on the "Build Now" button.
View Console Output: After the job has finished running, click on the build number under "Build History." This will take you to the build's page. Click on "Console Output" to see the printed "Hello World!" message.
Happy Learning
Thanks For Reading! :)
-Sriparthu💝💥