Jenkins 中轻量级结帐和浅层克隆之间的区别

Difference between lightweight checkout and shallow clone in Jenkins

Jenkins job builder的管道SCM配置中,我们有两个选项——轻量级校验和浅克隆。这些选项之间有什么区别,我们什么时候使用每个选项?

来自文档:

Shallow clone.
Perform a shallow clone, so that git will not download the history of the project, saving time and disk space when you just want to access the latest version of a repository.

Lightweight checkout.
If selected, try to obtain the Pipeline script contents directly from the SCM without performing a full checkout. The advantage of this mode is its efficiency; however, you will not get any changelogs or polling based on the SCM. (If you use checkout scm during the build, this will populate the changelog and initialize polling.) Also build parameters will not be substituted into SCM configuration in this mode. Only selected SCM plugins support this mode.

总结一下:

  • 浅克隆 是 Git 功能,可让您仅提取最新的提交,而不是整个回购历史。因此,如果你的项目有多年的历史,或者来自数千次提交的历史,你可以select一个特定的深度来拉动。
  • 轻量级签出 是 Jenkins 的一项功能,可以从存储库中提取特定文件,而不是整个存储库。因此,它非常有用,例如从存储库中获取 Jenkinsfile 时,因为您只需要特定文件而不关心其他 SCM 信息。