Set Rugged's search_path_system to support fsync flag
In https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7851#note_223344300, we are still seeing 0-byte files after reboots:
..it looks like the affected instances were all MR's in the process of being merged when the crash happened, rather than pushes by customers. Is it possible that whatever is doing the merges is subject to some other constraint or runs in a context where the fsync flag doesn't apply?
This may be happening because Rugged/libgit2 handles merges. https://github.com/libgit2/libgit2/pull/4030 appears to introduce a do_fsync
flag, Rugged isn't using this because it's reading from /etc/gitconfig
instead of /opt/gitlab/embedded/etc/gitconfig
.
I've confirmed running running the following Rugged command adjusts the search path so that Rugged loads the right config file:
Rugged::Settings['search_path_system'] = '/opt/gitlab/embedded/etc'
Note that the following does NOT work:
Rugged::Settings['search_path_global'] = '/opt/gitlab/embedded/etc'
The former causes Rugged to load /opt/gitlab/embedded/etc/gitconfig
(and the home /var/opt/gitlab/.gitconfig
), but the latter loads /opt/gitlab/embedded/etc/.gitconfig
(notice the extra dot).
search_path_system
should be a configuration option and passed into Gitaly from Omnibus or the Helm Chart.