Shell executors using fetch strategy on repos with squash-merge workflows eventually throw git gc warnings
Summary
We are in the middle of setting up our macOS build farm and are currently limited to running shell executors. The runners use git fetch
rather than git clone
strategy to save on build times. We've noticed that after a few days, each runner displays this warning message at the beginning of the build (when fetching the changes from the repo).
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
The majority of our engineers use a squash-merge workflow and it appears this is the reason for this. While this appears to be harmless it should be handled by the runner itself by running gc either periodically or as part of git fetch
.
Steps to reproduce
As mentioned in the summary
Actual behavior
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
Printed before every job on the affected runner.
Expected behavior
There shouldn't be a reason for the warning above.
Relevant logs and/or screenshots
Environment description
- Shell executor on persistent gitlab runner instances
-
git fetch
strategy used instead ofgit clone
- Squash-merge workflow causes rapid accumulation of loose git objects.
Used GitLab Runner version
11.0.0
Edited by Allwin Baby