What is Continuous Integration?
The process of having shorter release cycles(sometimes several times a day) i.e creating small features and integrating them to the source code, and employing automated build and test processes for quicker feedback is called Continuous Integration
Advantages of Continuous Integration
Frequent Commits hence small feature release
Automated Build and Testing
Instant Feedback to Developer
Low Risk and Faster Delivery
What is Jenkins?
Jenkins is an open-source automation server written in Java. Jenkins helps to automate the nonhuman part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery
Advantages of Using Jenkins
Jenkins isn't the only option for CI, but its characteristics make the server a contender for diverse development scenarios. The top five benefits of Jenkins are found in procurement, plugins, hosting options, community and integration. These benefits encapsulate what a DevOps team should look for in
Open source and free:- Developers and DevOps teams don't want to worry about procurement costs for code pipelines. They simply want to build code into an artifact or have a central location to standardize code deployments. To evaluate a CI tool, these software teams want access to trial scenarios. Tool evaluators also have to ensure that a tool's use can scale up across the team or company without creating a budget problem.
Plugins and integrations:-One of the primary advantages of Jenkins is the range of plugins available for the platform. Jenkins plugins can be developed by anyone.
Hosting options:- Jenkins installs and deploys on Microsoft Windows, any Linux distribution and Apple MacOS. Because Jenkins can run on any OS, the IT team can install the CI server regardless of the company's systems.
Community support:- Jenkins officially began in 2011 and developed for years before that in other permutations. It has a long history of operations for a CI/CD tool. Its availability as open-source code enables the creators, community contributors and users to participate in the tool's functionality, maintenance and roadmap, as an open-source product.
Integration with other CI/CD platforms:-Jenkins offers distinct benefits for software development, but that doesn't mean it's the only option for a CI/CD pipeline or the only CI choice in the organization.
Jenkins, for example, can work alongside another platform a software team uses for continuous delivery. Or, a team might integrate the CI and build a portion of a pipeline with another tool, then use Jenkins to build and store the application's artifacts.
Installation of Jenkins
Step 1:- Jenkins requires Java to run, yet certain distributions don’t include this by default. Using the below command we can install Java in any ubuntu machine
#Below command use for to update the system
sudo apt-get update
#Below command use to install java
sudo apt install openjdk-11-jre -y
#Below command use to check java intalled or not
java -version
Step 2:- Now order to install Jenkins need to run the below commands
Note:- I always recommend if you are installing commands from the official website it will be good
curl -fsSL https://pkg.jenkins.io/debian-stable/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-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins -y
Step 3:- By using the below command we can check the Jenkins running or not
#Below command use for to check the status of jenkins
systemctl status jenkins
#Below command use to enable the jenkins
sudo systemctl enable jenkins
If required the start and stop the Jenkins then need to use the below commands
#Below command to use for start jenkins
sudo systemctl start jenkins
#Below command to use for stop jenkins
sudo systemctl stop jenkins
Step 4:- By default, Jenkins uses the port 8080 server to run. Need to take Public IPv4 address:8080
Step 5:- To unlock the unlock Jenkins needs to run the below commands
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Step 6:- Now we need to select Install suggested plugins
Step 7:- Now we need to fill in the username, password, and full name. Once we have filled then we need to click Save and Continue
Step 8:- Now Jenkins is ready to use
Create a freestyle pipeline to print "Hello World"
Step 1:- First we need to create a job
Step 2:- Now we need to give the job name and need to choose freestyle project and click ok
Step 3:- After clicking ok in Description need to give meaningful description so anyone can understand
Step 4:- Then in the Build steps need to select Execute shell and Save those changes.
Step 5:- Now click on build now
Step 6:- After clicking on build now build will be successful and if we need to see the output then using Console Output we can see the expected results
Thank you for reading!! I hope you find this article helpful!!
if any queries or corrections to be done to this blog please let me know.
Happy Learning!!
Saikat Mukherjee