Stu*_*art 2 groovy jenkins jenkins-pipeline
我使用 Groovy DSL 定义了一个简单的 Jenkins 管道。我的目的是它只会检查我的 git 存储库。但是我收到错误。
鉴于我的 DSL 常规定义:
stage 'build'
node
{
git branch: '*/mybranch', credentialsId: 'my credentials', url: 'git@git.servername:pathto/myrepo.git'
}
Run Code Online (Sandbox Code Playgroud)
我希望 Jenkins 管道能够简单地检查我的 git 存储库。
但是我收到以下错误:
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?
更详细的版本有效:
checkout([$class: 'GitSCM', branches: [[name: '*/mybranch']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'myCredentials', url: 'git@git.servername:pathto/myrepo.git']]])
Run Code Online (Sandbox Code Playgroud)
不过,最好使用简写版本。