Skip to content

Project Setting "Git shallow clone" and "GIT_DEPTH" no longer working

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

⚠️ Update - workaround availabe in the following thread

Summary

The project level settings for "Git Shallow Clone" under the "Settings->CICD->General Pipeline" section do not appear to be working as in previous releases or as documented. Also, adding the "GIT_DEPTH" CICD variable does not seem to have any effect either.

Steps to reproduce

  1. Create a new project
  2. Commit one or more changes to the repo
  3. Create one or more branches or tags
  4. Execute a pipeline with at least one job
  5. Note that the branches or tags were not fetched in the pipeline job
  6. Change the default "Git Strategy" setting of the project to "Git Clone"
  7. Execute a pipeline with at least one job
  8. Note that the branches or tags were not fetched in the pipeline job
  9. Add the "GIT_DEPTH: 0" variable to the job
  10. Execute a pipeline with at least one job
  11. Note that the branches or tags were not fetched in the pipeline job

Example Project

https://gitlab.com/xendren-public/xen-issue-git-depth

What is the current bug behavior?

The git clone operation done in the pipeline does not appear to follow the instructions provided by either the project's "Git shallow clone" value or the "GIT_DEPTH" pipeline variable as stated in the documentation.

What is the expected correct behavior?

Per the documentation, a "Git shallow clone" value >0 and <=1000 should perform a shallow clone and fetch refs up to the value specified. A value of 0 or blank should not perform a shallow clone, but will fetch ALL refs. image

Relevant logs and/or screenshots

The default General Pipeline settings for a new project are as follows:
image

Created several branches and tags in the repository:
image

Executing the pipeline for the project, the refs are not being fetched with the default settings:
image

Try changing the "Git Strategy" to "Git Clone":
image

Does not work:
image

Try setting the "GIT_DEPTH = 0" in the pipeline script for the job:
image

Does not work:
image

Output of checks

This bug happens on GitLab.com

Edited by 🤖 GitLab Bot 🤖