问题描述
制作由,git步骤目前只有基本配置,只有一个url参数,它是使用一般结帐scm步骤来更复杂。
有了这个,就可以传递credentialsId了:
checkout scm:[$ class:'MercurialSCM',source:'ssh://[email protected]/user/repo',clean:true,credentialsId:'1234-5678-abcd']
但是,如何才能使用SSH密钥凭据进行工作呢?
相同的语法应该适用于SSH私钥证书。
顺便说一下你可以通过 credentialsId
到简单的 git
步骤。
Have a groovy script that's executed by the Jenkins Worflow Plugin.
As documented, the git step has only basic configuration so far, having only a single url parameter, and it's suggested to use the general checkout scm step for anything more complex.
With this, it's possible to pass credentialsId as so:
checkout scm: [$class: 'MercurialSCM', source: 'ssh://[email protected]/user/repo', clean: true, credentialsId: '1234-5678-abcd']
But how would one get this to work with an SSH key credentials instead?
The same syntax should work for SSH private key credentials.
By the way as of 1.4 you can pass credentialsId
to the simple git
step.
Also if you update the SSH Credentials plugin you can also choose a human-readable ID (when creating a new credentials item).
这篇关于如何在Jenkins Workflow插件中使用SSH密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!