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
- Create a new project
- Commit one or more changes to the repo
- Create one or more branches or tags
- Execute a pipeline with at least one job
- Note that the branches or tags were not fetched in the pipeline job
- Change the default "Git Strategy" setting of the project to "Git Clone"
- Execute a pipeline with at least one job
- Note that the branches or tags were not fetched in the pipeline job
- Add the "GIT_DEPTH: 0" variable to the job
- Execute a pipeline with at least one job
- 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.
Relevant logs and/or screenshots
The default General Pipeline settings for a new project are as follows:
Created several branches and tags in the repository:
Executing the pipeline for the project, the refs are not being fetched with the default settings:
Try changing the "Git Strategy" to "Git Clone":
Try setting the "GIT_DEPTH = 0" in the pipeline script for the job:
Output of checks
This bug happens on GitLab.com