diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-04-14 13:31:45 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-04-14 14:07:16 +0300 |
commit | c75e2d0e2c02704500e33cde706432fd2b063d98 (patch) | |
tree | c0046ebfc69dce44991ebc2afec115f61c21c0b7 /_support/test-boot | |
parent | a458bb1018cdfffda1220883399ea0d0f1a7b5de (diff) |
improve version check error message
_support/test-boot checks that 'gitaly -version' reports the correct
version denoted by the VERSION file. If the versions mismatch, the
error message currently just says 'gitaly -version failed'. This is
not very helpful so this commit improves the situation by actually
printing out the expected and actual content.
One potential source of failure is when a merge request is made from
a fork that does not contain the latest tags, causing `git describe`
to produce different output. This commit also adds a message about this
to help community contributors working from forks.
Diffstat (limited to '_support/test-boot')
-rwxr-xr-x | _support/test-boot | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/_support/test-boot b/_support/test-boot index 021ad7c04..ca19b118f 100755 --- a/_support/test-boot +++ b/_support/test-boot @@ -8,12 +8,13 @@ ADDR = 'socket'.freeze def main(gitaly_dir) gitaly_dir = File.realpath(gitaly_dir) - version = IO.popen("#{File.join(gitaly_dir, 'gitaly')} -version").read - version_from_file = "Gitaly, version #{IO.read(File.join(gitaly_dir, 'VERSION')).strip}" + version = IO.popen("#{File.join(gitaly_dir, 'gitaly')} -version").read.delete_prefix('Gitaly, version ').strip + version_from_file = IO.read(File.join(gitaly_dir, 'VERSION')).strip # Use start_with? instead of == because the version output could use git describe, if it is a source install # eg: Gitaly, version 1.75.0-14-gd1ecb43f - abort "\ngitaly -version failed" unless version.start_with?(version_from_file) + abort "\nversion check failed: VERSION file contained '#{version_from_file}' but 'gitaly -version' reported '#{version}'."\ + " If you are working from a fork, please fetch the latest tags." unless version.start_with?(version_from_file) Dir.mktmpdir do |dir| Dir.chdir(dir) |