[英]Jenkins groovy pipeline - git checkout error
I have defined a simple Jenkins pipeline using the Groovy DSL. 我已经使用Groovy DSL定义了一个简单的Jenkins管道。 My intention is that it will simply checkout my git repository.
我的意图是,它将仅签出我的git存储库。 However I am getting an error.
但是我遇到一个错误。
Given my groovy DSL defintion: 根据我的常规DSL定义:
stage 'build'
node
{
git branch: '*/mybranch', credentialsId: 'my credentials', url: 'git@git.servername:pathto/myrepo.git'
}
I'm expecting the Jenkins pipeline to simply checkout my git repository. 我期望Jenkins管道可以简单地检出git存储库。
However I'm getting the following error: 但是我收到以下错误:
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Can anyone help me in resolving this issue please? 谁能帮助我解决这个问题?
The more verbose version works: 更详细的版本适用:
checkout([$class: 'GitSCM', branches: [[name: '*/mybranch']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'myCredentials', url: 'git@git.servername:pathto/myrepo.git']]])
However it would be nice to use the short-hand version. 但是,最好使用简写版本。
Without the */ on the branch specifier works for me. 如果分支上没有* /,说明符对我有用。
Try this: 尝试这个:
git branch: 'mybranch', credentialsId: 'my credentials', url: 'git@git.servername:pathto/myrepo.git'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.