如何导出/导入Jenkins配置? [英] How to export/import the Jenkins configuration?

查看:9712
本文介绍了如何导出/导入Jenkins配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jenkins CLI 提供导出和导入单一功能作业,例如:

  java -jar jenkins-cli.jar -s http://foo-jenkins.tld:8080 get -job myjob> myjob.xml 
java -jar jenkins-cli.jar -s http://bar-jenkins.tld:8080 create-job newmyjob< myjob.xml

是否还可以/如何备份和还原配置? strong>






我的意思是整个设置:




  • 系统配置

  • 全局安全配置

  • 凭证

  • 全局工具配置

  • 插件配置(HTTP代理配置和已安装插件的列表)

  • li>
  • 用户

  • 是什么缺失?


b $ b

整个设置,或者甚至作为单个备份/恢复过程,例如Mozbackup及其组件选择







i.stack.imgur.com/CVp2y.pngalt =eclipse - 导出首选项>

解决方案

备份/导出配置的所选部分,因为 Jenkins配置数据分散在





  • 某些文件已加密(凭据),因此您还必须备份加密密钥



解决方案将备份整个 $ JENKINS_HOME ,并排除您所做的部分 不想成为备份的一部分(例如,排除 jobs / * / builds )。



这样的备份必须在文件系统级别完成,因为没有API可以访问所有这些文件/数据



不要依赖于 thinBackup ,因为您依赖于插件维护者不要错过任何重要的。例如,当前 thinBackup 版本1.7.4不会备份Jenkins的密钥,因此无法从头恢复凭据。


The Jenkins CLI provides the function to export&import single jobs, e.g.:

java -jar jenkins-cli.jar -s http://foo-jenkins.tld:8080 get-job myjob > myjob.xml
java -jar jenkins-cli.jar -s http://bar-jenkins.tld:8080 create-job newmyjob < myjob.xml

Is it also possible / How to backup&restore the configs?


I mean the whole settings:

  • the system configuration,
  • the global security configuration,
  • the credentials,
  • the global tool configuration,
  • the plugins configuration (the "HTTP Proxy Configuration" and the list of the installed plugins)
  • the nodes
  • the users
  • is anything missing?

The whole settings at once or maybe even as single backup/restore processes like e.g. MozBackup with its "Components selection"

or eclipse with its "Export Preferences" dialog

解决方案

There is no simple way to backup/export selected parts of the configuration, since Jenkins configuration data is scattered among

  • several files (global config.xml, lots of plugin-specific files)
  • several sub-directories (credentials, nodes) and
  • some of the files are encrypted (credentials), so you must also backup the encryption keys

The cleanest solution will be to back-up the entire $JENKINS_HOME, and to exclude those parts that you do not want to be part of the backup (e.g., exclude jobs/*/builds). With that you'll end up with a resonable backup size also.

Such a backup must be done on filesystem level, as there's no API to access all those files/data.

Do not rely on thinBackup, as you depend on the plugin maintainers to not miss anything important. E.g., current thinBackup version 1.7.4 will not backup Jenkins' secret keys, so it's impossible to restore credentials from scratch.

这篇关于如何导出/导入Jenkins配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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