Certified Jenkins Engineer

Backup and Configuration Management

Demo Backing upRestoring Jenkins

In this tutorial, you’ll learn how to install, configure, and use the Thin Backup plugin to back up and restore Jenkins global settings, job configurations, and optionally build artifacts.


1. What Is the Thin Backup Plugin?

The Thin Backup plugin provides lightweight, configurable backups of Jenkins home content:

  • Global configuration (config.xml, credentials).
  • Job-specific configurations.
  • Plugin definitions (optional).
  • Build results and artifacts (optional).

The image shows a webpage for the Jenkins plugin "ThinBackup," detailing its features, version information, and documentation links. It includes a description of the plugin's functionality and installation statistics.

Note

Thin Backup only stores essential configuration files by default. Use the optional settings to include plugins, artifacts, and zip archives.


2. Installing the Thin Backup Plugin

  1. Navigate to Manage JenkinsManage PluginsAvailable.
  2. Search for Thin Backup.
  3. Select and click Install without restart (or Download now and install after restart).

3. Configuring the Backup

  1. Go to Manage JenkinsConfigure System.

  2. Scroll to the Thin Backup section.

  3. Set the Backup Directory to a path on disk, for example:

    /var/lib/jenkins/Jenkins_backup
    
  4. Configure scheduling and retention:

OptionDescriptionDefault
ScheduleCron expression for automated backups(none)
Differential backupsStore only changed files since last full backupDisabled
Max number of backup setsRetain N backup sets10
Exclude filesRegex patterns to exclude specific files(none)
  1. Choose additional settings:

    • Archive plugin files
    • Zip backup folders
    • Include build results and artifacts

Warning

Backing up build results and artifacts can consume significant disk space. Monitor storage usage if you enable this option.

  1. Click Apply then Save.

4. Triggering a Manual Backup

  1. Go to Manage Jenkins.
  2. Under Tools and Actions, click Backup Now.

This initiates an on-demand backup using your current configuration.


5. Monitoring Backup Logs

View progress and any issues in Manage JenkinsSystem LogAll Jenkins Logs. Look for entries like:

INFO   ThinBackupMgmtLink      Starting manual backup.
INFO   HudsonBackup            No previous full backup found, creating one.
INFO   HudsonBackup            Found 16 jobs to back up.
INFO   HudsonBackup            Backup process finished successfully.

6. Verifying Backup Files on Disk

On the Jenkins server shell:

cd /var/lib/jenkins/Jenkins_backup
ls
cd FULL-$(date +%Y-%m-%d)_$(date +%H-%M)/
ls

You should see directories for:

  • config.xml
  • jobs/
  • plugins/
  • builds/ (if enabled)

7. Deleting and Restoring a Job

  1. In the Jenkins UI, delete a sample job (e.g., Monitor-Jenkins).
  2. Navigate to Manage JenkinsThin BackupRestore Configuration.
  3. Select the desired backup date and click Restore.

The image shows a Jenkins interface with a "Restore Configuration" screen, where a backup date is selected for restoration. The sidebar includes options like "Manage Jenkins" and "Build History."

  1. Restart Jenkins for the restored items to appear.
  2. Log back in and confirm the deleted job is restored with its build history.

8. Optional: Backing Up Build Results

To include build logs and artifacts in your backups:

  1. Open Manage JenkinsConfigure System.
  2. Under Thin Backup, enable Backup build results and artifacts.
  3. Save changes and run a manual backup to capture builds.

The image shows a Jenkins system configuration page with backup settings, including options for backup frequency and data to be backed up.


9. Summary

You’ve now:

  • Installed the Thin Backup plugin.
  • Configured backup paths, schedules, and retention.
  • Performed manual backups and monitored logs.
  • Restored deleted jobs and configurations.
  • Enabled optional build-data backups.

For advanced usage, explore differential backups, custom exclusion patterns, and integration with external storage.

Watch Video

Watch video content

Previous
Backing upRestoring Jenkins