Add command-line check for Git hook internal API connectivity

During a Git push, Gitaly's git hooks (pre-receive, post-receive) must be able to reach GitLab's internal API. This is a pain point when setting up Gitaly on a remote server.

In gitlab-shell we used to have a setup helper bin/check which would verify that the API can be reached. This helper got vendored into Gitaly (as ruby/gitlab-shell/bin/check) but it does not work correctly, and it is too hard to invoke. This is because we need to set special environment variables such as GITLAB_SHELL_DIR, which Gitaly normally sets based on config.toml.

We should have a way to ask Gitaly:

given this config.toml, can the Git hooks reach the internal GitLab API?

This should either be a new executable in Gitaly, or a sub-command of an existing executable (maybe a sub command of gitaly-hooks?).

Edited by Jacob Vosmaer