如何备份Jenkins作业到远程机器 [英] How to take backup of Jenkins jobs to remote machine

查看:402
本文介绍了如何备份Jenkins作业到远程机器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Jenkins服务器到一些远程机器定期备份Jenkins作业。我尝试探索几个Jenkins插件,但没有一个不能采取备份到远程机器。

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.

我成功地使用shell脚本备份的Jenkins工作区但在这种情况下很难恢复备份。

I successfully take backup of the Jenkins workspace using the shell script but in that case it's hard to restore the backup.

任何建议?

推荐答案

如果我可以建议一种不同的方法 - 如果你使用任何类型的源代码控制,最好备份你的文件和配置。例如 - 如果你将使用git,你可以打开你的Jenkins配置的存储库。

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.

备份您的


  • 工作文件夹

  • 节点文件夹

  • 父文件夹文件(config.xml,所有插件配置等)

那么这只是每12小时运行一次从Jenkins运行预定作业的问题:

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

这将使您能够:


  • 为您备份Jenkins配置

  • 管理备份版本

  • 查看您对配置所做更改的历史记录

希望它有所帮助。

这篇关于如何备份Jenkins作业到远程机器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆