A Jenkins backup and restore python cli tool with arguments.
Project description
Python Jenkins Backup Restore Module
Jenkins-backup-restore module takes a backup of the jenkins home directory and restores it.
Backup
Following are the list of items that the backup module can do,
- Look for the JENKINS_HOME env values (or use the default /var/jenkins_home). Export JENKINS_HOME, if does not exists.
- Take a backup of the jenkins_home with tar and stores it in current directory (default: /var/jenkins_home)
- Move the backup tar to a specific folder locally (optional with flags).
- Push the backup tar to a specific bucket in S3 (optional with flags).
Restore
Following are the list of items that the restore module can do,
- Look for the binary in the local file system in the specific destination path.
- Extract the tar file to JENKINS_HOME path (default: /var/jenkins_home)
- 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)
- Extract the tar file to JENKINS_HOME path (default: /var/jenkins_home)
Installation
Run the following command to install the jenkins-backup-restore tool,
pip3 install jenkins-backup-restore-cli
Backup and Restore Arguments:
Once the binary is installed with pip3, use the following command line argument to either take a backup or restore the existing backup.
--v, --version Show program's version number
--cn, --custom-archive-name Give the backup a custom name
# 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
Examples
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for jenkins-backup-restore-cli-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07cdd507dcf6bdd9cf4499688a704e26116c01753040ae1f7ba4a5da736a8e85 |
|
MD5 | 0fc5ac8c4f56a9cab81d57aada1d25fc |
|
BLAKE2b-256 | 54bc8c3b565e0d12dfa582a5d5be02dc43b74d5b1d931996c103700ced739acd |