🔶What is Jenkins?
Jenkins is an open-source automation server that streamlines the processes of building, testing, and deploying software. It is written in Java and is a pivotal tool in the DevOps ecosystem. Jenkins is known for implementing Continuous Integration (CI) and Continuous Delivery/Deployment (CD) workflows, often called pipelines.
💠Integrating Jenkins into the DevOps Lifecycle
In the DevOps lifecycle, Jenkins plays a crucial role by enabling continuous integration and delivery. Here's how Jenkins integrates into the various stages of DevOps:
Source Code Management: Jenkins integrates with Git to pull the latest code from repositories whenever changes are committed.
Build Automation: Jenkins automates code compilation and packaging using build tools like Maven or Gradle.
Automated Testing: Jenkins runs automated tests to check for code changes that could affect the existing functionality, helping to maintain code quality and reliability.
Deployment Automation: Once the code is built and tested, Jenkins can automatically deploy the application to different environments, reducing manual intervention and human error.
Monitoring and Feedback: Jenkins provides real-time feedback and monitoring of the build and deployment processes, enabling developers to address issues promptly.
💠Benefits of Using Jenkins
Automation: Jenkins automates repetitive tasks, freeing up developers to focus on more critical aspects of development.
Efficiency: With Jenkins, the time taken to build, test, and deploy code is significantly reduced, leading to faster release cycles.
Scalability: Jenkins supports distributed builds, allowing multiple build agents to run simultaneously, thus handling large projects efficiently.
Extensibility: The vast library of plugins available for Jenkins allows it to integrate with numerous tools and services, enhancing its functionality.
᯽Role of Jenkins in Automating Build, Test, and Deployment Processes
Jenkins is instrumental in automating the entire software development lifecycle:
Build: Jenkins pulls the latest code from the repository, compiles it, and packages it into a deployable format.
Test: It runs automated tests to verify the integrity of the code. This includes unit tests, integration tests, and even performance tests.
Deploy: Jenkins can deploy the built application to different environments, ensuring that the application is always in a deployable state.
By automating these processes, Jenkins ensures that software development is faster, more reliable, and more consistent.
☑️Task 1: Jenkins Installation on Linux(Ubuntu
)
Step 1: Installations of Java
sudo apt update
sudo apt install openjdk-17-jre
java -version
Step 2: Installations of Jenkins
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 3: Enable, Start and View Status
sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
Step 4: Open Browser and Search
https://<IP>:8080
Step 5: Command for view default Password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Step 6: Select Install suggested plugins
Step 7: Plugins are getting installing
Step 8: Jenkins set-up is ready for use
Step 9: Jenkins Dashboard
☑️Task 2: Create a freestyle pipeline to print "Hello World!!"
Step 1: Click on New Item
to create a pipeline
Step 2: Give the pipeline name & Choose Freestyle Project
Step 3: Give a description(optional)
Step 4: Add a build step - Execute shell.
Step 5: Make the status of the node Online
Step 6: Now click on Build Now
to run the Job.
Step 7: Click on Console output
to see the result.
Step 8: After the execution is done stop
the Jenkins
sudo systemctl stop jenkins
sudo systemctl status jenkins
🎯Conclusion
By following these steps, we have successfully created a Freestyle Pipeline
in Jenkins that prints "Hello World,"
.This pipeline is a simple example of how Jenkins can automate tasks, making it a valuable tool for DevOps engineers.