How to use SSH keys with Jenkins Workflow Plugin

旧巷老猫 提交于 2019-12-23 17:07:59

问题


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://hg@bitbucket.org/user/repo', clean: true, credentialsId: '1234-5678-abcd']

But how would one get this to work with an SSH key credentials instead?


回答1:


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).



来源:https://stackoverflow.com/questions/28632566/how-to-use-ssh-keys-with-jenkins-workflow-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!