问题
I want to take scheduled backup of Jenkins jobs form Jenkins server to some remote machine. I tried exploring several Jenkins plugins for that but none of that are not able to take backup to the remote machine.
I successfully take backup of the Jenkins workspace using the shell script but in that case it's hard to restore the backup.
Any Suggestions?
回答1:
If I can suggest a different approach - if you're using any kind of source control it'll be better to backup your files and configuration there. for example - if you will work with git you can open a repository for your Jenkins configuration.
Back up your:
- jobs folder
- nodes folder
- parent folder files (config.xml, all plugins configurations, etc.)
then it is only a matter of running a scheduled job from Jenkins every 12 hours running:
cd $JENKINS_HOME
git add --all
git commit -m "Automated backup commit: $BUILD_TIMESTAMP"
git push
* Make sure you have the right permissions to run those command on the master
This will enable you to:
- Keep backups for you Jenkins configuration
- Manage versions of backups
- View history of changes you made to your configurations
Hope it helps.
来源:https://stackoverflow.com/questions/37317008/how-to-take-backup-of-jenkins-jobs-to-remote-machine