I would recommend to check https://issues.jenkins-ci.org/browse/JENKINS-43878 for better understanding. The reporter of this ticket compares the duration of clone+checkout process in 3 cases: non-shallow clone with git command, shallow clone with pipeline and shallow clone(depth=1) with git command, and the ticket reporter complains that case #2 lasts much longer than case #3.
I exercised with the repo https://github.com/tesseract-ocr/tessdata (~5 GB) and I could not reproduce the duration difference. But I observed the big size difference. These are my measurements:
- Full clone with pipeline: 8 min, total size 4615 MB, "fetch size" 3256 MB.
- Full clone with "git clone": 8 min, total size 4615 MB.
- Shallow clone(depth=1) with pipeline: 4-5 min, total size 3121 MB, "fetch size" 1762 MB
- Shallow clone(depth=1) with "git clone": 4-5 min, total size 1995 MB.
(the "fetch" size in my comparison is the size of the directory which I measured with "du -ms" at the moment after "git fetch" and before "git checkout" when it was done with the help of Jenkins pipeline)
If you compare cases 3 and 4 you will see that for shallow clone the pipeline (that is "fetch+checkout") approach leads to more disk space occupation than for the normal "clone".
The pipeline maintainers agreed with this fact, but closed the ticket with "Won't fix", because they don't want to change the way of working from "fetch+checkout" to "clone" for the plugin due to other reasons.
This is exactly answer to your question why don't you see big difference between shallow and full clone for Jenkins pipeline: because Jenkins pipeline uses "fetch+checkout" approach which in case of --depth works differently than "clone" and downloads more data than "clone".
If you need a normal "clone --depth" it should be run as a shell command from the pipeline script. On my opinion it is a disadvantage of Jenkins pipeline.
[
that is missing a matching]
, by the way. – Ensure