How to take backup of Jenkins jobs to remote machine

╄→尐↘猪︶ㄣ 提交于 2019-12-25 07:27:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!