【发布时间】:2019-10-03 06:12:24
【问题描述】:
我们的项目仓库非常大(2.5GB)。因此,在脚本化管道中的 checkout(scm) 步骤中,从 GIT 克隆代码需要更长的时间。由于 GIT 试图获取整个历史记录,我们正面临以下错误。
到目前为止我已经尝试过结帐(scm),我在https://jenkins.io/doc/pipeline/steps/workflow-scm-step/中读到 有一个名为 depth 的选项,通过它我们可以只下载最近的提交。
但我不知道它的语法。
node(nodeName) {
try {
deleteDir()
checkout(scm)
....
....
}
catch(Exception ex) {
throw ex
}
}
如果克隆时间减少,那将是非常有益的。 在执行 line checkout(scm) 时,
我们有时会收到以下错误。
using credential Servicejenkins_build
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository
hudson.plugins.git.GitException: Command "C:\Git\cmd\git fetch --no-tags --progress https://gitlab.com/../../supportforpc.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Enumerating objects: 1
remote: Enumerating objects: 24671, done.
remote: Counting objects: 0% (1/24671)
remote: Counting objects: 1% (247/24671)
remote: Counting objects: 2% (494/24671)
remote: Counting objects: 3% (741/24671)
remote: Counting objects: 4% (987/24671)
remote: Counting objects: 5% (1234/24671)
remote: Counting objects: 6% (1481/24671)
.....
....
Counting objects: 100% (24671/24671)
remote: Compressing objects: 0% (1/10279)
remote: Compressing objects: 1% (103/10279)
remote: Compressing objects: 2% (206/10279)
remote: Compressing objects: 3% (309/10279)
remote: Compressing objects: 4% (412/10279)
remote: Compressing objects: 5% (514/10279)
remote: Compressing objects: 6% (617/10279)
remote: Compressing objects: 7% (720/10279)
remote: Compressing objects: 8% (823/10279)
remote: Compressing objects: 9% (926/10279)
remote: Compressing objects: 10% (1028/10279)
....
....
remote: Compressing objects: 100% (10279/10279)
Receiving objects: 0% (1/24671)
Receiving objects: 1% (247/24671)
Receiving objects: 2% (494/24671)
Receiving objects: 3% (741/24671)
Receiving objects: 4% (987/24671)
Receiving objects: 5% (1234/24671)
Receiving objects: 6% (1481/24671)
....
....
Receiving objects: 43%
fatal: index-pack failed
error: RPC failed; curl 56 SSL read:
error:00000000:lib(0):func(0):reason(0), errno 10054
因此我认为,在结帐(scm)中使用深度 1 可能会解决问题。但我不知道脚本管道中的语法。
【问题讨论】:
标签: jenkins jenkins-pipeline jenkins-groovy