一旦我尝试升级我的 Jenkins 作业以使用分支参数而不是硬编码值,它就不再起作用了。
尝试了除 BUILD_BRANCH 之外的许多其他名称
在这里,我尝试了 ${env.BUILD_BRANCH}, refs/heads${BUILD_BRANCH} 并且绝对没有一个工作
当我最初这样做时,我确实检查了轻量级 checkout ,在阅读了许多具有相同问题的在线答案后,我将其删除。依然没有!。我刚刚添加了“删除”命令以查看是否有帮助,但没有
错误:
> git rev-list --no-walk 97428a402f3304a21ccc8df435a40468ebf406c1 # timeout=10
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] readTrusted
[Pipeline] End of Pipeline
hudson.plugins.git.GitException: Command "git fetch --tags --progress --prune -- origin +refs/heads/${BUILD_BRANCH}:refs/remotes/origin/${BUILD_BRANCH}" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/heads/${BUILD_BRANCH}
fatal: The remote end hung up unexpectedly
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2429)
感谢您的阅读,即使您无能为力
最佳答案
您是否在 Pipeline SCM 部分中选择了轻量级 checkout ?取消选中轻量级 checkout 为我解决了这个问题。
关于git - 当我使用参数化分支 : fatal: Couldn't find remote ref refs/heads/${BUILD_BRANCH} 时,Jenkins 无法构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60381036/