How to Configure Jenkins

Last updated on May 28 2022
Uma Kulkarni

Table of Contents

How to Configure Jenkins

Jenkins – Configuration

You probably would have seen a couple of times within the previous exercises wherein we had to configure options within Jenkins. The subsequent shows the various configuration options in Jenkins.

So one can get the various configuration options for Jenkins by clicking the ‘Manage Jenkins’ option from the left hand menu side.

How to Configure Jenkins
How to Configure Jenkins

You’ll then be presented with the subsequent screen −

How to Configure Jenkins
How to Configure Jenkins

Click on Configure system. Discussed below are some of the Jenkins configuration settings which can be carried out.
Jenkins Home Directory

Jenkins needs some disk space to perform builds and keep archives. One can check this location from the configuration screen of Jenkins. By default, this is set to ~/.jenkins, and this location will initially be stored within your user profile location. In a proper environment, you need to change this location to an adequate location to store all relevant builds and archives. Once can do this within the subsequent ways

• Set “JENKINS_HOME” environment variable to the new home directory before launching the servlet container.
• Set “JENKINS_HOME” system property to the servlet container.
• Set JNDI environment entry “JENKINS_HOME” to the new directory.

The subsequent example will use the first option of setting the “JENKINS_HOME” environment variable.

First create a new folder E:\Apps\Jenkins. Copy all the contents from the existing ~/.jenkins to this new directory.

Set the JENKINS_HOME environment variable to point to the base directory location where Java is installed on your machine. For example,

OS Output

Windows Set Environmental variable JENKINS_HOME to you’re the location you desire. As an example you can set it to E:\Apps\Jenkins

Linux export JENKINS_HOME =/usr/local/Jenkins or the location you desire.

Within the Jenkins dashboard, click Manage Jenkins from the left hand side menu. Then click on ‘Configure System’ from the right hand side.

Within the Home directory, you’ll now see the new directory which has been configured.

How to Configure Jenkins
How to Configure Jenkins

# of executors

This refers to the total number of concurrent job executions that can take place on the Jenkins machine. This can be changed based on requirements. Sometimes the recommendation is to keep this number the equivalent as the number of CPU on the machines for better performance.

Environment Variables

This is employed to add custom environment variables which will apply to all the jobs. These are key-value pairs and can be accessed and employed in Builds wherever required.

Jenkins URL

By default, the Jenkins URL points to localhost. If you’ve a domain name setup for your machine, set this to the domain name else overwrite localhost with IP of machine. This will help in setting up slaves and while sending out links using the email as you can directly access the Jenkins URL using the environment variable JENKINS_URL which can be accessed as ${JENKINS_URL}.

Email Notification

Within the email Notification area, you can configure the SMTP settings for sending out emails. This is required for Jenkins to connect to the SMTP mail server and send out emails to the recipient list.

Jenkins – Management

To manage Jenkins, click on the ‘Manage Jenkins’ option from the left hand menu side.

So one can get the various configuration options for Jenkins by clicking the ‘Manage Jenkins’ option from the left hand menu side.

How to Configure Jenkins
How to Configure Jenkins

You’ll then be presented with the subsequent screen −

How to Configure Jenkins
How to Configure Jenkins

Some of the management options are as follows −

Configure System

This is where one can manage paths to the various tools to use in builds, such as the JDKs, the versions of Ant and Maven, as well as security options, email servers, and other system-wide configuration details. When plugins are installed. Jenkins will add the required configuration fields dynamically after the plugins are installed.

Reload Configuration from Disk

Jenkins stores all its system and build job configuration details as XML files which is stored within the Jenkins home directory. Here also all of the build history is stored. If you are migrating build jobs from one Jenkins instance to another, or archiving old build jobs, you’ll need to add or remove the corresponding build job directories to Jenkins’s builds directory. You don’t need to take Jenkins offline to do this—you can simply use the “Reload Configuration from Disk” option to reload the Jenkins system and build job configurations directly.

Manage Plugin

Here one can install a wide variety of third-party plugins right from different Source code management tools such as Git, Mercurial or ClearCase, to code quality and code coverage metrics reporting. Plugins can be installed, updated and removed through the Manage Plugins screen.

How to Configure Jenkins
How to Configure Jenkins

System Information

This screen displays a list of all the current Java system properties and system environment variables. Here one can check exactly what version of Java Jenkins is running in, what user it is running under, and so forth.

The subsequent screenshot shows some of the name-value information available in this section.

How to Configure Jenkins
How to Configure Jenkins

System Log

The System Log screen is a convenient way to view the Jenkins log files in real time. Again, the main use of this screen is for troubleshooting.

Load Statistics

This page displays graphical data on how busy the Jenkins instance is in terms of the number of concurrent builds and the length of the build queue which gives an idea of how long your builds need to wait before being executed. These statistics can give a good idea of whether extra capacity or extra build nodes is required from an infrastructure perspective.

Script Console

This screen lets you run Groovy scripts on the server. It is useful for advanced troubleshooting since it requires a strong knowledge of the internal Jenkins architecture.

Manage nodes

Jenkins is capable of handling parallel and distributed builds. In this screen, you can configure how many builds you want. Jenkins runs simultaneously, and, if you are using distributed builds, set up build nodes. A build node is another machine that Jenkins can use to execute its builds.

Prepare for Shutdown

If there is a need to shut down Jenkins, or the server Jenkins is running on, it is best not to do so when a build is being executed. To shut down Jenkins cleanly, you can use the Prepare for Shutdown link, which prevents any new builds from being started. Eventually, when all of the current builds have finished, one will be able to shut down Jenkins cleanly.

So, this brings us to the end of blog. This Tecklearn ‘How to Configure Jenkins’ blog helps you with commonly asked questions if you are looking out for a job in DevOps. If you wish to learn Jenkins and build a career in DevOps domain, then check out our interactive, Continuous Integration with Jenkins Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

Continuous Integration with Jenkins

Continuous Integration with Jenkins Training

About the Course

Tecklearn has specially designed this Continuous Integration with Jenkins Training Course to advance your skills for a successful career in this domain. This course helps you learn server automation, continuous integration, build and configuration tools, Jenkins master-slave architecture, different types of plugins, implementing automated testing and more through hands-on projects and exercises. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Jenkins.

Why Should you take Continuous Integration with Jenkins Training?

• Average salary of Jenkins Professional is $110k (Indeed.com Salary Data)
• Jenkins is an open-source automation server which enables developers around the world to reliably build, test, and deploy their software.

What you will Learn in this Course?

Introduction to DevOps

• What is Software Development
• Software Development Life Cycle
• Why DevOps?
• What is DevOps?
• DevOps Lifecycle
• DevOps Tools
• Benefits of DevOps
• How DevOps is related to Agile Delivery
• DevOps Implementation

Continuous Integration with Jenkins

• Introduction to Continuous Integration and Jenkins
• Jenkins Management
• Jenkins Master Slave Architecture
• Tools Required for CI
• Understanding CI/CD Pipelines
• Creating an end-to-end automated CI/CD Pipeline
• Jenkins Versions

0 responses on "How to Configure Jenkins"

Leave a Message

Your email address will not be published. Required fields are marked *