Configuring backup for Jenkins

Backup configuration is one of the most important tasks associated with Jenkins server. You should always take regular backup of the Jenkins configuration, plugins, jobs and associated job configuration. In Jenkins, all the settings, build logs and archives of the artifacts are stored under the JENKINS_HOME directory. The easiest way is to just make a copy of the directory and whenever the same needs to be used, restore the contents from copy.

This directory information can be found from Manage Jenkins -> System information or going to http:///systemInfo page:

Jenkins system information.JPG
Jenkins system information

This should be set to C:\Program Files (x86)\Jenkins for windows servers and /var/lib/jenkins on linux distributions such as CentOS / Ubuntu by default.

The build jobs created under this directory contains all the details of each and every individual jobs configured in the Jenkins install:

Jenkins home content directories.JPG
Jenkins home content directories

Any job can be moved from one installation directory to another just by copying the jobs. Same goes for restoring jobs.

To make our process easier, we need to install plugins for backup from Manage Plugins section:

backup plugins installation.JPG
backup plugins installation

Again it will download any missing dependent plugins and let’s restart Jenkins once the plugins are installed. Once it’s done, you would see two new options enabled in the Manage Jenkins page:


Let’s first explore backup manager. Go to Backup Manager -> Setup and fill the details as below and save it:

Backup manager configuration.JPG
Backup manager configuration

For our backup purposes, we have created a directory at /jenkins_backups and using the same. It should be the absolute path on the server whether windows or linux and you should have already created it. Also make sure that you have assigned permissions to Jenkins service account using chown (in linux), for example: chown jenkins.jenkins /jenkins_backups/. Or the same goes for windows.

Then select backup hudson configuration from same plugin and it will backup the configuration for you. This is a backup at system level. For fine level backup or for schedule backups, we can use thin backup plugin. Let’s go to thin backup settings or http:///thinBackup/backupsettings page. Here, again we need to provide directory location to store backups and we can also specify schedule in cron job notation. However for our case, we’ll leave this empty for now and go with below settings:

Thin backup settings.JPG
Thin backup settings

Once done, let’s go ahead and try a sample backup and see if it works. There isn’t any progress you can see once you click on backup now. So after clicking it, hold for some time to see if the backup is completed or not. The most reliable option is to check the contents of the backup directory:

Contents of the sample backup using thin backup plugin.JPG
Contents of the sample backup using thin backup plugin

Restore option in the plugin is not of much use but since individual files are there, selective restore is possible.

One thought on “Configuring backup for Jenkins

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s