Commit b0b53a78 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'fix-cache-issue-for-gitaly-gems-in-setup-test-env' into 'master'

Ensure Gitaly gems are installed under vendor/gitaly-ruby

See merge request gitlab-org/gitlab!57992
parents 5f1ffc7c c68bf5f5
...@@ -13,6 +13,8 @@ class GitalyTestBuild ...@@ -13,6 +13,8 @@ class GitalyTestBuild
include GitalyTest include GitalyTest
def run def run
set_bundler_config
abort 'gitaly build failed' unless build_gitaly abort 'gitaly build failed' unless build_gitaly
ensure_gitlab_shell_secret! ensure_gitlab_shell_secret!
......
...@@ -9,6 +9,7 @@ class GitalyTestSpawn ...@@ -9,6 +9,7 @@ class GitalyTestSpawn
include GitalyTest include GitalyTest
def run def run
set_bundler_config
install_gitaly_gems if ENV['CI'] install_gitaly_gems if ENV['CI']
check_gitaly_config! check_gitaly_config!
......
...@@ -34,6 +34,10 @@ module GitalyTest ...@@ -34,6 +34,10 @@ module GitalyTest
File.join(tmp_tests_gitaly_dir, 'ruby', 'Gemfile') File.join(tmp_tests_gitaly_dir, 'ruby', 'Gemfile')
end end
def gemfile_dir
File.dirname(gemfile)
end
def gitlab_shell_secret_file def gitlab_shell_secret_file
File.join(tmp_tests_gitlab_shell_dir, '.gitlab_shell_secret') File.join(tmp_tests_gitlab_shell_dir, '.gitlab_shell_secret')
end end
...@@ -42,8 +46,7 @@ module GitalyTest ...@@ -42,8 +46,7 @@ module GitalyTest
env_hash = { env_hash = {
'HOME' => File.expand_path('tmp/tests'), 'HOME' => File.expand_path('tmp/tests'),
'GEM_PATH' => Gem.path.join(':'), 'GEM_PATH' => Gem.path.join(':'),
'BUNDLE_APP_CONFIG' => File.join(File.dirname(gemfile), '.bundle/config'), 'BUNDLE_APP_CONFIG' => File.join(gemfile_dir, '.bundle'),
'BUNDLE_FLAGS' => "--jobs=4 --retry=3",
'BUNDLE_INSTALL_FLAGS' => nil, 'BUNDLE_INSTALL_FLAGS' => nil,
'BUNDLE_GEMFILE' => gemfile, 'BUNDLE_GEMFILE' => gemfile,
'RUBYOPT' => nil, 'RUBYOPT' => nil,
...@@ -52,13 +55,20 @@ module GitalyTest ...@@ -52,13 +55,20 @@ module GitalyTest
'GITALY_TESTING_NO_GIT_HOOKS' => "1" 'GITALY_TESTING_NO_GIT_HOOKS' => "1"
} }
env_hash
end
# rubocop:disable GitlabSecurity/SystemCommandInjection
def set_bundler_config
system('bundle config set --local jobs 4', chdir: gemfile_dir)
system('bundle config set --local retry 3', chdir: gemfile_dir)
if ENV['CI'] if ENV['CI']
bundle_path = File.expand_path('../vendor/gitaly-ruby', __dir__) bundle_path = File.expand_path('../vendor/gitaly-ruby', __dir__)
env_hash['BUNDLE_FLAGS'] += " --path=#{bundle_path}" system('bundle', 'config', 'set', '--local', 'path', bundle_path, chdir: gemfile_dir)
end end
env_hash
end end
# rubocop:enable GitlabSecurity/SystemCommandInjection
def config_path(service) def config_path(service)
case service case service
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment