本文介绍了如何在Jenkins Workflow插件中使用SSH密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

制作由,git步骤目前只有基本配置,只有一个url参数,它是使用一般结帐scm步骤来更复杂。



有了这个,就可以传递credentialsId了:

  checkout scm:[$ class:'MercurialSCM',source:'ssh://[email protected]/user/repo',clean:true,credentialsId:'1234-5678-abcd'] 

但是,如何才能使用SSH密钥凭据进行工作呢?

解决方案

相同的语法应该适用于SSH私钥证书。



顺便说一下你可以通过 credentialsId 到简单的 git 步骤。

另外,如果您更新SSH Credentials插件,您可以还要选择一个人类可读的ID(当创建一个新的凭证项目时)。


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密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 05:31