diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef28688f91956f608b69abda8232160b277bb20b..941a78ad27226f2e7cfc2a70f8ffbb2df9328aa4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -67,6 +67,11 @@ danger-review: paths: - ruby/vendor/bundle policy: pull + artifacts: + paths: + - ruby/tmp/gitaly-rspec-test.log + when: on_failure + expire_in: 1 week .test_template: &test_definition <<: *go_test_definition diff --git a/ruby/spec/integration_helper.rb b/ruby/spec/integration_helper.rb index 57e22b9b63cc8b38186bada03ca6cd4c79bcc4fb..37f4c266c6a1f849d7ad9ebd72eb5e795bde28a6 100644 --- a/ruby/spec/integration_helper.rb +++ b/ruby/spec/integration_helper.rb @@ -4,6 +4,7 @@ require 'gitaly' require 'spec_helper' SOCKET_PATH = 'gitaly.socket'.freeze +RUBY_PATH = File.expand_path('../', __FILE__) TMP_DIR = File.expand_path('../../tmp', __FILE__) module IntegrationClient @@ -17,6 +18,16 @@ module IntegrationClient end end +def env + env_hash = { + 'BUNDLE_FLAGS' => "--jobs=4 --retry=3", + 'BUNDLE_INSTALL_FLAGS' => nil, + 'RUBYOPT' => nil + } + env_hash['BUNDLE_APP_CONFIG'] = File.join(RUBY_PATH, '.bundle/config') unless ENV['CI'] + env_hash +end + def start_gitaly build_dir = File.expand_path('../../../_build', __FILE__) gitlab_shell_dir = File.join(TMP_DIR, 'gitlab-shell') @@ -26,13 +37,13 @@ def start_gitaly config_toml = <<~CONFIG socket_path = "#{SOCKET_PATH}" bin_dir = "#{build_dir}/bin" - + [gitlab-shell] dir = "#{gitlab_shell_dir}" - + [gitaly-ruby] dir = "#{build_dir}/assembly/ruby" - + [[storage]] name = "#{DEFAULT_STORAGE_NAME}" path = "#{DEFAULT_STORAGE_DIR}" @@ -42,7 +53,9 @@ def start_gitaly test_log = File.join(TMP_DIR, 'gitaly-rspec-test.log') options = { out: test_log, err: test_log, chdir: TMP_DIR } - gitaly_pid = spawn(File.join(build_dir, 'bin/gitaly'), config_path, options) + + gitaly_pid = spawn(env, File.join(build_dir, 'bin/gitaly'), config_path, options) + at_exit { Process.kill('KILL', gitaly_pid) } wait_ready!(File.join('tmp', SOCKET_PATH)) end