Skip to main content

A Jenkins backup and restore python cli tool with arguments.

Project description

Python Jenkins Backup Restore Module

PyPI - Downloads PyPI - Version

Jenkins-backup-restore module takes a backup of the jenkins home directory and restores it.


Following are the list of items that the backup module can do,

  1. Look for the JENKINS_HOME env values (or use the default /var/jenkins_home). Export JENKINS_HOME, if does not exists.
  2. Take a backup of the jenkins_home with tar and stores it in current directory (default: /var/jenkins_home)
  3. Move the backup tar to a specific folder locally (optional with flags).
  4. Push the backup tar to a specific bucket in S3 (optional with flags).


Following are the list of items that the restore module can do,

  1. Look for the binary in the local file system in the specific destination path.
  2. Extract the tar file to JENKINS_HOME path (default: /var/jenkins_home)
  3. Look for the a artifact binary in the s3 given a specific bucket name and download it in the current directory unless a specific artifact destination path is given. (optional with flags)
  4. Extract the tar file to JENKINS_HOME path (default: /var/jenkins_home)


Run the following command to install the jenkins-backup-restore tool,

pip3 install jenkins-backup-restore-cli


Once the binary is installed with pip3, use the following command line argument to either take a backup or restore the existing backup.

    --version                      Show program's version number

    --custom-archive-name          Give the backup a custom name

    --jenkins-home-dir              Custom Jenkins home directory other than the default (/var/jenkins_home)

Backup option with arguments:

    # backup to a local dir command and argument
    backup-local                        Save the archive to a local directory
    -bd, --backup-destination-path,     Local path to store the backup
    # backup to s3 command and argument
    backup-s3                           Push the archive to an s3 bucket
    -bb, --backup-bucket-name,          Bucket name to push an archive to s3
    # restore archive from a local directory 
    restore-local                        Restore archive from a local directory
    -rs, --restore-source-path           Path to the archive in local directory
    -rd, --restore-destination-path      If destination path is other than the default path (/var/jenkins_home)
    # restore archive from an s3 bucket
    restore-s3                           Pull an archive from an s3 bucket to a specific location and restore it
    -rb, --restore-bucket-name           Bucket name to download the archive from
    -adp, --artifact-destination-path    Path to save the downloaded archive from an s3 bucket

  {backup,restore}                       use either backup to backup or use restore to restore


To give a custom name to the backup

jenkins-backup-restore-cli backup-local --cn <custom-name.tar.gz> backup

If --backup-destination-path not specified, stores in the current directory.

To backup jenkins to local directory,

jenkins-backup-restore-cli backup-local --backup-destination-path <custom-dir> backup

To backup jenkins to an s3 bucket,

jenkins-backup-restore-cli backup-local --backup-bucket-name <bucket-name> backup

To restore an archive from local path,

jenkins-backup-restore-cli restore-local --restore-source-path <archive-path> restore

To restore an archive from an s3 bucket,

jenkins-backup-restore-cli restore-s3 --restore-bucket-name <bucket-name> --artifact-destination-path <path-to-download-in-local> restore


There is a simple Dockerfile that has the package installed on it.

Helm Chart

There is a Helm chart for the jenkins-backup-restore-cli tool with a here.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jenkins-backup-restore-cli, version 1.0.8
Filename, size File type Python version Upload date Hashes
Filename, size jenkins-backup-restore-cli-1.0.8.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page