There are three aspects to the configuration of the "Take backup" builder.
First you should decide "what to backup": the data included/excluded from the backup. This plugin divides Jenkins storage into three classifications:
- System configuration
-
This includes all the settings scoped to the entire Jenkins Enterprise, such as everything in the system configuration page, plugin binaries, plugin settings, user information, fingerprints. Anything that lives outside the individual job directory.
Security
This category includes a master key which is used by Jenkins Enterprise to encrypt all other private information such as passwords in job configuration. You are recommended to select the configuration option to omit this master key from backup, since it is small and never changes once created; store it elsewhere and manually re-add it when resurrecting a backup.
- Job configuration
- This includes all the settings scoped to individual jobs. Mostly this maps to the job configuration, and is generally the most precious data.
- Build records
- This includes information scoped to individual builds, such as its console output, artifacts, test reports, code analysis reports, and so on. Build records can be quite large and may be dispensable.
When selecting any of these, you may optionally specify a list of file patterns to exclude from the backup. The Backup plugin ships with a number of standard exclusions for well-known files created by Jenkins and popular plugins that would be pointless or expensive to back up. Nonetheless, you may need to add some custom entries appropriate for your own installation. You can also use the exclude list to suppress certain jobs (or whole folders) from backup, and so on.
The next aspect is "where to backup", which controls the destination of the backup.
- Local directory
- This tells Jenkins Enterprise to backup data as a file in the file system of the master. For disaster recovery purpose, it is recommended that you back up files to a network mounted disk.
- Remote SFTP server
- This tells Jenkins Enterprise to connect to a remote SFTP server and send a backup over there. This is more convenient way to back up to a remote system on Unix as it requires no shared file system.
- Remote WebDAV server
- This tells Jenkins Enterprise to connect to a WebDAV server and store a backup in a configured directory.
The last aspect is the retention policy, which controls how many/long backups are kept. By using this switch you can avoid run-away disk consumption caused by old backups. Backup retention is based on file names; backup file names include the job name and the build number of the backup job. So you can safely use a single destination directory for multiple backup jobs and their backup retention policies are enforced without interfering with each other.
- Exponential decay
- This tells Jenkins to keep lots of newer backups and fewer old backups. It’s called "exponential decay" because the number of backups kept is proportional to e^-t. In this way, you’ll always cover the entire lifespan of your Jenkins installation with some backups, with more coverage on recent data.
- Keep all backups
- In this mode, Jenkins will not delete any backups that it has created. This is useful if you are managing backup retention externally, such as via logrotate.
- Keep N backups
- In this mode, Jenkins will keep the latest N backups and delete any older ones.