GCK fails to run gitaly for purpose of tests

GCK consistently fails to compile Gitaly and returns a cryptic error not indicating the type of problem occuring:

==> Gitaly set up in 142.574253676 seconds...
/home/git/gitlab/spec/support/helpers/gitaly_setup.rb:193:in `try_connect!': could not connect to tmp/tests/gitaly/gitaly.socket (RuntimeError)
	from /home/git/gitlab/spec/support/helpers/gitaly_setup.rb:123:in `start'
	from /home/git/gitlab/spec/support/helpers/gitaly_setup.rb:105:in `start_gitaly'
	from /home/git/gitlab/scripts/gitaly-test-spawn:20:in `run'
	from /home/git/gitlab/scripts/gitaly-test-spawn:26:in `<main>'
 FAILED to connect to gitaly
An error occurred in a `before(:suite)` hook.
Failure/Error: raise message
RuntimeError:

This fails, because:

  • gitlab-build-images defines GIT_VERSION and execution of make all git fails to apply patches in Gitaly context as it considers this GIT_VERSION to be the one on which to apply patches when running make git
  • there's no way to unset GIT_VERSION that is inherited via docker layers
  • the GIT_VERSION can only be unset in a current shell via env -u GIT_VERSION

This is hard to debug/fix, because:

  • We do not check if make all git in tmp/tests/gitaly successfully executed, and we return cryptic errors: gitlab!72984 (merged)
  • We have no easy way to consistently unset GIT_VERSION, and the GIT_VERSION= (empty value) is not being accepted: gitaly!4010 (merged)
  • Workaround: !182 (merged)
Edited by Kamil Trzciński