check: Ensure unpacked binaries are cleaned up
Addresses #6413
The gitaly check
command instantiates a GitLabHookManager to verify
that Gitaly is able to access Rails' /internal/check endpoint. The hook
manager requires an ExecCommandFactory which requires Git binaries to be
configured properly. Due to this, we must unpack the embedded Git
binaries into cfg.RuntimeDir
when this command is executed.
There were two problems with the implementation:
- We didn't clean up the runtime directory, so multiple invocations of the command would fail when it tries to unpack binaries into an existing location.
- We use
cfg.RuntimeDir
directly as configured in config.toml. We should instead be creating subdirectories like we do elsewhere.
Address these problems by unpacking binaries into a subdirectory of
cfg.RuntimeDir
, and ensure the subdirectory is cleaned up at the
end of execution