summaryrefslogtreecommitdiff
path: root/scripts/gitaly-test-build
blob: 48bf2f96ac7babd60aa05b8b27e692841a4a15ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env ruby

require 'fileutils'

# 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.

tmp_tests_gitaly_dir = File.expand_path('../tmp/tests/gitaly', __dir__)
gitaly_ruby_gemfile_path = File.join(tmp_tests_gitaly_dir, 'ruby', 'Gemfile'),
gitaly_ruby_bundle_path = File.join(tmp_tests_gitaly_dir, 'ruby', 'vendor'),

env = {
  'BUNDLE_GEMFILE' => gitaly_ruby_gemfile_path,
  'BUNDLE_FLAGS' => "--jobs=4 --path=#{gitaly_ruby_bundle_path} --retry=3"
}

abort 'gitaly build failed' unless system(env, 'make', chdir: tmp_tests_gitaly_dir)

# 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.
FileUtils.touch(File.join(tmp_tests_gitaly_dir, 'gitaly'), mtime: Time.now + (1 << 24))