2017-07-31 09:17:14 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2017-08-03 06:15:08 -04:00
|
|
|
require 'fileutils'
|
|
|
|
|
2017-07-31 09:17:14 -04:00
|
|
|
# This script assumes tmp/tests/gitaly already contains the correct
|
|
|
|
# Gitaly version. We just have to compile it and run its 'bundle
|
|
|
|
# install'. We have this separate script for that because weird things
|
|
|
|
# were happening in CI when we have a 'bundle exec' process that later
|
|
|
|
# called 'bundle install' using a different Gemfile, as happens with
|
|
|
|
# gitlab-ce and gitaly.
|
|
|
|
|
2018-01-22 05:13:33 -05:00
|
|
|
tmp_tests_gitaly_dir = File.expand_path('../tmp/tests/gitaly', __dir__)
|
2017-08-03 06:15:08 -04:00
|
|
|
|
2018-01-22 05:13:33 -05:00
|
|
|
# Use the top-level bundle vendor folder so that we don't reinstall gems twice
|
|
|
|
bundle_vendor_path = File.expand_path('../vendor', __dir__)
|
|
|
|
|
|
|
|
env = {
|
|
|
|
# This ensure the `clean` config set in `scripts/prepare_build.sh` isn't taken into account
|
|
|
|
'BUNDLE_IGNORE_CONFIG' => 'true',
|
|
|
|
'BUNDLE_GEMFILE' => File.join(tmp_tests_gitaly_dir, 'ruby', 'Gemfile'),
|
|
|
|
'BUNDLE_FLAGS' => "--jobs=4 --path=#{bundle_vendor_path} --retry=3"
|
|
|
|
}
|
|
|
|
|
|
|
|
abort 'gitaly build failed' unless system(env, 'make', chdir: tmp_tests_gitaly_dir)
|
2017-08-03 06:15:08 -04:00
|
|
|
|
|
|
|
# Make the 'gitaly' executable look newer than 'GITALY_SERVER_VERSION'.
|
|
|
|
# Without this a gitaly executable created in the setup-test-env job
|
|
|
|
# will look stale compared to GITALY_SERVER_VERSION.
|
2018-01-22 05:13:33 -05:00
|
|
|
FileUtils.touch(File.join(tmp_tests_gitaly_dir, 'gitaly'), mtime: Time.now + (1 << 24))
|