our project repo is very big (2.5GB). Hence upon checkout(scm) step in the scripted pipeline, the code takes longer time to clone from GIT. and We are facing the below errors, due to GIT trying to fetch the entire history.
I have tried so far with checkout(scm), I read in https://jenkins.io/doc/pipeline/steps/workflow-scm-step/ that there is an option called depth, by which we can download only the recent commits.
But i don't know the syntax for it.
node(nodeName) {
try {
deleteDir()
checkout(scm)
....
....
}
catch(Exception ex) {
throw ex
}
}
If the cloning times reduces, it would be a lot beneficial. Upon executing the line checkout(scm),
We are sometimes getting the below error.
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
Hence I thought, using depth 1 in checkout(scm) might solve the issue. But i dont know the syntax in scripted pipeline.