patternMinor
GitLab CI/CD job without pulling LFS files?
Viewed 0 times
withoutgitlablfsfilespullingjob
Problem
When our GitLab CI/CD job runs, it first pulls a Docker image and then git clones the entire repo. Afterwards, the Build commands are executed in the Docker image, etc.
Is it possible to only clone the non-LFS files from the repo? ... Or perhaps clone the HEAD of the master branch from only a specific subdirectory and it's subdirectories, etc.?
Is it possible to only clone the non-LFS files from the repo? ... Or perhaps clone the HEAD of the master branch from only a specific subdirectory and it's subdirectories, etc.?
Solution
Yes, full cloning of LFS files can be restricted! By default, GitLab will clone your repo into the CI/CD build directory. To limit the clone from downloading the LFS files, tell it not to do it. You do this by setting a variable in
The "smudge" process replaces the link/pointers to the LFS files with the actual files. By telling GitLab's CI job to skip the smudge, the LFS files aren't downloaded.
Placing
.gitlab-ci.yml like this.# Other declarations etc above the specific job
jobname:
variables:
GIT_LFS_SKIP_SMUDGE: 1
# More job declarations, etc.The "smudge" process replaces the link/pointers to the LFS files with the actual files. By telling GitLab's CI job to skip the smudge, the LFS files aren't downloaded.
Placing
GIT_LFS_SKIP_SMUDGE: 1 in a variables section at the top may make it apply to all of the defined jobs.Code Snippets
# Other declarations etc above the specific job
jobname:
variables:
GIT_LFS_SKIP_SMUDGE: 1
# More job declarations, etc.Context
StackExchange DevOps Q#8353, answer score: 5
Revisions (0)
No revisions yet.