Reputation: 99
If I need to backup jenkins configurations, do you have good recommendations? I'm researching and found https://wiki.jenkins.io/display/JENKINS/Backup+Plugin but I want to be able to automate the whole process
Upvotes: 0
Views: 908
Reputation: 2545
You can use Gearman plugin as an alternative, it supports backup as well as failover in the evnt of an outage.
Upvotes: 0
Reputation: 5319
The way I like to do it is as a git repo. Init the repo in the JENKINS_HOME directory. Add a .gitignore file to eliminate the workspace directory(s). Optionally, you can ignore the log and/or logs directories. The plugins directory can probably be rebuilt entirely and doesn't need to be backed up, but it might make sense to dump a directory listing of the plugins directory to a file, or better yet, hit this url and dump that content to a file before you commit changes:
http://jenkinsurl/pluginManager/api/json?depth=1&pretty=true.
You can also ignore the caches directory and the war directory.
Setup a cron job, or a job in Jenkins to commit the changes the git repo on a regular basis. Even put a Jenkinsfile in the root of JENKINS_HOME and use that as your pipeline job to backup itself.
Upvotes: 2