【发布时间】:2016-11-22 12:51:43
【问题描述】:
我在关注this tutorial:
node {
git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git'
...
}
但是它没有说明如何添加凭据。 Jenkins 确实有特定的“凭据”部分,您可以在其中定义用户 user&pass,然后获取 ID 以在作业中使用,但是如何在 Pipeline 指令中使用它?
我试过了:
git([url: 'git@bitbucket.org:company/repo.git', branch: 'master', credentialsId: '12345-1234-4696-af25-123455'])
运气不好:
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.
有没有办法在管道中配置凭据,或者我必须将 SSH 密钥放入 Jenkins 的 Linux 用户的 .ssh/authorized_keys 文件中?
在理想情况下,我希望有一个用于管道作业和 repo-keys 的存储库,然后启动 Docker Jenkins,并在其中动态添加这些作业和密钥,而无需在 Jenkins 控制台中进行任何配置。
【问题讨论】:
标签: git jenkins ssh jenkins-pipeline