我下面this tutorial:签出Jenkins Pipeline Git SCM凭证?
node {
git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git'
...
}
但是它并没有告诉如何添加凭据。詹金斯确实有特定的“证书”部分,您可以在其中定义用户用户& pass,然后获取用于作业的ID,但是如何在管道指令中使用该ID?
我试着用:
git([url: '[email protected]: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.
有没有办法配置管道vim的信任状,或做我必须把SSH密钥对詹公司的Linux用户的.ssh/authorized_keys文件?
在理想的世界中,我希望有一个管道作业和回购密钥的存储库,然后启动Docker Jenkins,并在那里动态添加这些作业和密钥,而无需在Jenkins控制台中配置任何内容。
修好了,谢谢。我不知道SSH-url和HTTPS-url需要不同的凭证才能使用! – Render
这很有帮助,但'credentialsId'来自['/var/lib/jenkins/credentials.xml'](https://stackoverflow.com/a/35603191/432903)中的id,因为我不得不努力去计算它出。 – prayagupd
@prayagupd,你应该能够从凭证页面('http:// yourjenkinsinstall/credentials')获得凭证ID。无需拖曳配置文件。 –