Skip to content

gitaly: Make unix socket paths absolute

James Liu requested to merge jliu-absolute-gitaly-dir into master

What does this MR do and why?

Part of gitaly#6065

The self.address method is used to retrieve the socket path for a given Gitaly node. This is called in production, and also in the spec/support/helpers/gitaly_setup.rb to configure Gitaly's runtime directory for tests.

In production we expect an absolute socket path to be provided. Within tests however, a path relative to the gitlab/ checkout is used (typically tmp/tests/gitaly/praefect.socket or similar). gitaly_setup aims to correct for this by expanding the path as necessary when configuring Gitaly for tests, but not all code seems to source the address from the this configuration.

Using a relative path causes issues when git invocations in Gitaly are restricted to a specific working directory (see gitaly!6913 (merged) for more information). Test failures suggest that relative socket paths are to blame. This is because the socket path is sent as metadata along with gRPC requests into Gitaly, where they get extracted and used to invoke other Gitaly nodes.

Modify the self.address method to transform unix socket addresses to their absolute form. Other schemes are left as-is.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by James Liu

Merge request reports