我正在学习本教程:
node {
git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git'
...
}
Run Code Online (Sandbox Code Playgroud)
但是,它没有说明如何添加凭据.Jenkins确实有特定的"凭据"部分,您可以在其中定义用户user&pass,然后获取要在作业中使用的ID,但是如何在管道指令中使用它?
我尝试过:
git([url: 'git@bitbucket.org:company/repo.git', branch: 'master', credentialsId: '12345-1234-4696-af25-123455'])
Run Code Online (Sandbox Code Playgroud)
没运气:
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
有没有办法在管道中配置信用卡,还是我必须将SSH密钥放到Jenkin的Linux用户的.ssh/authorized_keys文件中?
在理想的世界中,我想拥有一个管道作业和repo-keys的存储库,然后启动Docker Jenkins,并在那里动态添加这些作业和密钥,而无需在Jenkins控制台中进行任何配置.
我正在尝试将凭据从一个Jenkins迁移到另一个但是用户名/密码在$ {JENKINS_HOME} /credentials.xml中进行哈希处理
我找到了这个答案,但问题是它没有解释为了成功迁移凭据,有人会找到加密密钥的位置.
任何帮助是极大的赞赏!
编辑:更多信息..我的$ {JENKINS_HOME}是在一个单独的卷上,我分离并重新连接到新的VM,它仍然无法与我一起工作.