Book Image

Jenkins 2.x Continuous Integration Cookbook - Third Edition

By : Mitesh Soni, Alan Mark Berg
Book Image

Jenkins 2.x Continuous Integration Cookbook - Third Edition

By: Mitesh Soni, Alan Mark Berg

Overview of this book

Jenkins 2.x is one of the most popular Continuous Integration servers in the market today. It was designed to maintain, secure, communicate, test, build, and improve the software development process. This book will begin by guiding you through steps for installing and configuring Jenkins 2.x on AWS and Azure. This is followed by steps that enable you to manage and monitor Jenkins 2.x. You will also explore the ways to enhance the overall security of Jenkins 2.x. You will then explore the steps involved in improving the code quality using SonarQube. Then, you will learn the ways to improve quality, followed by how to run performance and functional tests against a web application and web services. Finally, you will see what the available plugins are, concluding with best practices to improve quality.
Table of Contents (11 chapters)

Configuring JENKINS_HOME

The .jenkins is the main directory that contains all the details for Jenkins installation files, configurations, plugins, build job configuration, and so on.

Getting ready

It is important to keep the .jenkins directory at a location where a good amount of free space is available. By default, Jenkins creates .jenkins (or JENKINS_HOME) at a specific location considering the operating systems.

For example, in Windows it is available at C:\Users\<USER_NAME>\.jenkins.

How to do it...

  1. In Windows, to change to JENKINS_HOME, go to the Control Panel | All Control Panel Items | System.
  2. Click on Advanced System Settings.
  3. Click on Environment Variables.
  4. Create a new variable JENKINS_HOME and give the path:
  1. In Ubuntu, go to /etc/default/Jenkins.
  2. Change the JENKINS_HOME location:
  1. Once changes are done, save the changes.

How it works...

Once JENKINS_HOME is changed, you need to restart Jenkins. The next time Jenkins starts, it will take JENKINS_HOME as the location that you have configured.

There's more...

The following table describes the default location of JENKINS_HOME in different operating systems:

Operating system

$JENKINS_HOME location

Windows

C:\Program Files (x86)\jenkins

or C:\Users\<USER>\.jenkins

Mac OSX

Macintosh HD/Users/Shared/Jenkins

Ubuntu/Debian

/var/lib/jenkins

Red Hat/CentOS/Fedora

/var/lib/jenkins

OpenSUSE

/var/lib/jenkins

FreeBSD

/usr/local/etc/jenkins

OpenBSD

/usr/local/etc/jenkins