有一个很棒的脚本,由Jenkins Worflow Plugin执行。
正如文档所述,git步骤目前只有基本配置,只有一个url参数,并且建议对于任何更复杂的操作使用通用的checkout scm步骤。
通过这种方式,可以传递credentialsId:
“但是,如何使用 SSH 密钥凭据使其工作?”
正如文档所述,git步骤目前只有基本配置,只有一个url参数,并且建议对于任何更复杂的操作使用通用的checkout scm步骤。
通过这种方式,可以传递credentialsId:
checkout scm: [$class: 'MercurialSCM', source: 'ssh://hg@bitbucket.org/user/repo', clean: true, credentialsId: '1234-5678-abcd']
“但是,如何使用 SSH 密钥凭据使其工作?”
credentialsId
是没有引号的。你需要确保传递引号(我猜是单引号)以确保它正常工作,像这样git url: 'ssh://git@repourl/project.git',credentialsId: 'someIDHere'
,否则你的构建将失败并显示堆栈跟踪信息。 - Signus