O'Reilly logo

Jenkins: The Definitive Guide by John Ferguson Smart

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Backing Up Your Configuration

Backing up your data is a universally recommended practice, and your Jenkins server should be no exception. Fortunately, backing up Jenkins is relatively easy. In this section, we will look at a few ways to do this.

Fundamentals of Jenkins Backups

In the simplest of configurations, all you need to do is to periodically back up your JENKINS_HOME directory. This contains all of your build jobs configurations, your slave node configurations, and your build history. This will also work fine while Jenkins is running—there is no need to shut down your server while doing your backup.

The downside of this approach is that the JENKINS_HOME directory can contain a very large amount of data (see What’s in the Jenkins Home Directory). If this becomes an issue, you can save a little by not backing up the following directories, which contain data that can be easily recreated on-the-fly by Jenkins:

$JENKINS_HOME/war

The exploded WAR file

$JENKINS_HOME/cache

Downloaded tools

$JENKINS_HOME/tools

Extracted tools

You can also be selective about what you back up in your build jobs data. The $JENKINS_HOME/jobs directory contains job configuration, build history and archived files for each of your build jobs. The structure of a build job directory is illustrated in Figure 13-9.

The builds directory

Figure 13-9. The builds directory

To understand how to optimize your Jenkins backups, you need to understand ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required