如何将凭证从一个詹金斯实例导出到另一个? [英] How to export credentials from one jenkins instance to another?
问题描述
我正在使用Jenkins中的凭据插件来管理团队构建的git和数据库访问凭据.我想将凭证从一个jenkins实例复制到另一个独立的jenkins实例.我将如何去做?
I am using the credentials plugin in Jenkins to manage credentials for git and database access for my team's builds. I would like to copy the credentials from one jenkins instance to another, independent jenkins instance. How would I go about doing this?
推荐答案
更新: TL; DR 请遵循链接,这是最简单的方法.万一它对您不起作用,请继续阅读.
UPDATE: TL;DR Follow the link provided below in a comment by Filip Stachowiak it is the easiest way to do it. In case it doesn't work for you go on reading.
复制$ HUDSON_HOME/credentials.xml并不是解决方案,因为Jenkins会对密码进行加密,除非另外两个实例共享一个公用密钥,否则它们无法被另一个实例解密.
Copying the $HUDSON_HOME/credentials.xml is not the solution because Jenkins encrypts paswords and these can't be decrypted by another instance unless both share a common key.
So, either you use the same encription keys in both Jenkins instances (Where's the encryption key stored in Jenkins? ) or what you can do is:
- 在第二个Jenkins实例中创建您需要共享的相同用户名/密码,以便生成有效密码
-
真正重要的是,两个credit.xml中的用户标识是相同的.为此,用户: Jenkins 的标识符(请参见下面的凭据.xml示例),两个凭据.xml中的标识符
<id>c4855f57-5107-4b69-97fd-298e56a9977d</id>
必须相同
- Create the same user/password, you need to share, in the 2nd Jenkins instance so that a valid password is generated
What is really important is that user ids in both credentials.xml are the same. For that (see the credentials.xml example below) for user: Jenkins the identifier
<id>c4855f57-5107-4b69-97fd-298e56a9977d</id>
must be the same in both credentials.xml
<com.cloudbees.plugins.credentials.SystemCredentialsProvider plugin="credentials@1.22">
<domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash">
<entry>
<com.cloudbees.plugins.credentials.domains.Domain>
<specifications/>
</com.cloudbees.plugins.credentials.domains.Domain>
<java.util.concurrent.CopyOnWriteArrayList>
<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
<scope>GLOBAL</scope>
<id>c4855f57-5107-4b69-97fd-298e56a9977d</id>
<description>Para SVN</description>
<username>jenkins</username>
<password>J1ztA2vSXHbm60k5PjLl5jg70ZooSFKF+kRAo08UVts=
</password>
</com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
</java.util.concurrent.CopyOnWriteArrayList>
</entry>
</domainCredentialsMap>
</com.cloudbees.plugins.credentials.SystemCredentialsProvider>
这篇关于如何将凭证从一个詹金斯实例导出到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!