gpt4 book ai didi

Jenkins Groovy 管道 - git checkout 错误

转载 作者:行者123 更新时间:2023-12-02 04:04:03 30 4
gpt4 key购买 nike

我使用 Groovy DSL 定义了一个简单的 Jenkins 管道。我的目的是它只会检查我的 git 存储库。但是我收到错误。

考虑到我的 DSL 定义:

stage 'build'
node
{
git branch: '*/mybranch', credentialsId: 'my credentials', url: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3e59574a7e59574a104d5b4c485b4c505f535b" rel="noreferrer noopener nofollow">[email protected]</a>: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: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="74131d0034131d005a0711060211061a151911" rel="noreferrer noopener nofollow">[email protected]</a>:pathto/myrepo.git']]])

不过,最好使用简写版本。

关于Jenkins Groovy 管道 - git checkout 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40401469/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com