Jenkins Lab
Jenkins Lab
Jenkins is a software that allows continuous integration. Jenkins will be installed on a server
where the central build will take place. The following flowchart demonstrates a very simple
workflow of how Jenkins works.
Along with Jenkins, sometimes, one might also see the association of Hudson. Hudson is a
very popular open-source Java-based continuous integration tool developed by Sun
Microsystems which was later acquired by Oracle. After the acquisition of Sun by Oracle, a
fork was created from the Hudson source code, which brought about the introduction of
Jenkins.
System Requirements
Disk Space No minimum requirement. Note that since all builds will be
stored on the Jenkins machines, it has to be ensured that
sufficient disk space is available for build storage.
Java Container The WAR file can be run in any container that supports
Servlet 2.4/JSP 2.0 or later.(An example is Tomcat 5).
Advantages of using Jenkins
Jenkins is being managed by the community which is very open. Every
month, they hold public meetings and take inputs from the public for the
development of Jenkins project.
So far around 280 tickets are closed, and the project publishes stable
release every three months.
As technology grows, so does Jenkins. So far Jenkins has around 320
plugins published in its plugins database. With plugins, Jenkins becomes
even more powerful and feature rich.
Jenkins tool also supports cloud-based architecture so that you can
deploy Jenkins in cloud-based platforms.
The reason why Jenkins became popular is that it was created by a
developer for developers.
Its interface is out dated and not user friendly compared to current UI
trends.
Though Jenkins is loved by many developers, it’s not that easy to
maintain it because Jenkins runs on a server and requires some skills as
server administrator to monitor its activity.
One of the reasons why many people don’t implement Jenkins is due to
its difficulty in installing and configuring Jenkins.
Continuous integrations regularly break due to some small setting
changes. Continuous integration will be paused and therefore requires
some developer attention.
JENKINS INSTALLATION PROCESS :
: • Once the Jenkins environment is set up, you can explore the various features and functionalities
available in the web interface.
• Jenkins has a rich user interface that provides access to features such as build history, build
statistics, and system information. These are the basic steps to install and set up Jenkins. Depending
on your use case, you may need to customize your Jenkins environment further. For example, you
may need to configure build agents, set up build pipelines, or integrate with other tools. However,
these steps should give you a good starting point for using Jenkins for CI/CD in your software
development projects.
Jenkins provides a user-friendly web interface for managing
projects and jobs. Here are some of the key features of the
Jenkins environment:
Dashboard: The Jenkins dashboard provides an overview of
all the projects and jobs currently running.
Jobs: Jobs are the basic building blocks of Jenkins, and they
define a sequence of steps to be executed.
Build history: Jenkins keeps track of the build history for
each job, which can be useful for tracking changes and
identifying issues.
Plugins: Jenkins has a large collection of plugins that can be
used to extend its functionality, such as integrating with other
tools and services.
Configuration: Jenkins provides a configuration interface
where you can set up projects, jobs, and build environments.
By exploring these features and customizing the Jenkins
environment to your needs, you can create a powerful and
flexible CI/CD system for your projects.
Jenkins Architecture
Let us have a look at the Jenkins Architecture below diagram depicts the same.
This single Jenkins server was not enough to meet certain requirements like:
Explore Curriculum
Jenkins Master
Your main Jenkins server is the Master. The Master’s job is to handle:
Jenkins Slave
A Slave is a Java executable that runs on a remote machine. Following are the
characteristics of Jenkins Slaves:
Jenkins checks the Git repository at periodic intervals for any changes
made in the source code.
Each builds requires a different testing environment which is not possible
for a single Jenkins server. In order to perform testing in different
environments, Jenkins uses various Slaves as shown in the diagram.
Jenkins Master requests these Slaves to perform testing and to generate
test reports.
Manage Nodes.
4. Enter the details of the node slave machine. Here no. of executers in nothing but no. of
jobs that this slave can run parallely. Here we have kept it to 2. The Labels for which the
name is entered as “Slave1” is what can be used to configure jobs to use this slave
machine.Select Usage to Use this node as much as possible. For launch method we select
the option of “Launch agent by connecting it to the master”. If this option is not visible then
go to Jenkins home page -> Manage Jenkins -> Configure Global Security. Here in the
Agents section click on Random and Save it. Now you will find the required option.
Enter Custom WorkDir path as the workspace of your slave node. In Availability select
“Keep this agent online as much as possible”.Click on Save.
Once you complete the above steps, the new node machine will initially be in an offline state
but will come online if all the settings in the previous screen were entered correctly. One can
at any time make the node slave machine offline if required.
5. Now since your slave is up and running, lets execute a job on slave.
• Create a simple Java application that you want to integrate with Jenkins.
• The application should have some basic functionality, such as printing "Hello World" or
performing simple calculations. Commit the code to a Git repository:
• Create a Git repository for the application and commit the code to the repository.
• Make sure that the Git repository is accessible from the Jenkins server.
• Configure the job to build the Java application from the Git repository.
• Specify the build triggers, such as building after every commit to the repository.
The build should show the build log, test results, and the status of the build.
• If the build is successful, configure the Jenkins job to deploy the application to a production
environment.
• The deployment could be as simple as copying the jar file to a production server or using a
more sophisticated deployment process, such as using a containerization technology like
Docker.
• Jenkins should automatically build and deploy the changes to the production environment.
This is a basic example of how you can use Jenkins to demonstrate CI/CD in software
development. In a real-world scenario, you would likely have more complex requirements,
such as multiple environments, different types of tests, and a more sophisticated deployment
process. However, this example should give you a good starting point for using Jenkins for
CI/CD in your software development projects.
CREATE A JOB :