簡體   English   中英

Jenkins Groovy管道-git checkout錯誤

[英]Jenkins groovy pipeline - git checkout error

我已經使用Groovy DSL定義了一個簡單的Jenkins管道。 我的意圖是,它將僅簽出我的git存儲庫。 但是我遇到一個錯誤。

根據我的常規DSL定義:

stage 'build'
node 
{
    git branch: '*/mybranch', credentialsId: 'my credentials', url: 'git@git.servername:pathto/myrepo.git'
}

我期望Jenkins管道可以簡單地檢出git存儲庫。

但是我收到以下錯誤:

ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE

誰能幫助我解決這個問題?

更詳細的版本適用:

checkout([$class: 'GitSCM', branches: [[name: '*/mybranch']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'myCredentials', url: 'git@git.servername:pathto/myrepo.git']]])

但是,最好使用簡寫版本。

如果分支上沒有* /,說明符對我有用。

嘗試這個:

git branch: 'mybranch', credentialsId: 'my credentials', url: 'git@git.servername:pathto/myrepo.git'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM