From 07c606703ef1510d35aa6c49ea2aec8f8a505670 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 5 Oct 2018 12:18:14 +0200 Subject: [PATCH 1/2] Try to fix "bundle in bundle" rspec problems --- internal/linguist/linguist.go | 2 ++ ruby/Gemfile | 1 + ruby/Gemfile.lock | 3 ++- ruby/spec/integration_helper.rb | 12 +++++++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/linguist/linguist.go b/internal/linguist/linguist.go index 9c7feeb2f78..d2d1d3c17dc 100644 --- a/internal/linguist/linguist.go +++ b/internal/linguist/linguist.go @@ -86,6 +86,8 @@ func openLanguagesJSON() (io.ReadCloser, error) { rubyScript := `FileUtils.ln_sf(Bundler.rubygems.find_name('github-linguist').first.full_gem_path, ARGV.first)` cmd := exec.Command("bundle", "exec", "ruby", "-rfileutils", "-e", rubyScript, linguistPathSymlink.Name()) cmd.Dir = config.Config.Ruby.Dir + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { if exitError, ok := err.(*exec.ExitError); ok { diff --git a/ruby/Gemfile b/ruby/Gemfile index 2b752992fec..9b6924f86d0 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' +gem 'bundler', '~> 1.16.4' gem 'rugged', '~> 0.27.4' gem 'github-linguist', '~> 6.1', require: 'linguist' gem 'gitlab-markup', '~> 1.6.4' diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index d76ba86c398..d7071aa9617 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -146,6 +146,7 @@ PLATFORMS DEPENDENCIES activesupport (~> 5.0.2) + bundler (~> 1.16.4) faraday (~> 0.12) gitaly-proto (~> 0.116.0) github-linguist (~> 6.1) @@ -162,4 +163,4 @@ DEPENDENCIES sentry-raven (~> 2.7.2) BUNDLED WITH - 1.16.4 + 1.16.6 diff --git a/ruby/spec/integration_helper.rb b/ruby/spec/integration_helper.rb index 57e22b9b63c..f76e640ff9e 100644 --- a/ruby/spec/integration_helper.rb +++ b/ruby/spec/integration_helper.rb @@ -42,8 +42,18 @@ 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) + gemfile = File.expand_path('../../Gemfile', __FILE__) + env = { + 'GEM_PATH' => Gem.path.join(':'), + 'BUNDLE_APP_CONFIG' => File.join(File.dirname(gemfile), '.bundle/config'), + 'BUNDLE_GEMFILE' => gemfile, + 'RUBYOPT' => nil + } + + 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 -- GitLab From 018d5f15b5b425c62fd018fb747107cd6b7e7a8a Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 5 Oct 2018 12:28:19 +0200 Subject: [PATCH 2/2] Tail logs for CI debugging --- ruby/spec/integration_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruby/spec/integration_helper.rb b/ruby/spec/integration_helper.rb index f76e640ff9e..4ac7c0e92ab 100644 --- a/ruby/spec/integration_helper.rb +++ b/ruby/spec/integration_helper.rb @@ -52,6 +52,8 @@ def start_gitaly gitaly_pid = spawn(env, File.join(build_dir, 'bin/gitaly'), config_path, options) +sleep 1; spawn("tail -f #{test_log}") + at_exit { Process.kill('KILL', gitaly_pid) } wait_ready!(File.join('tmp', SOCKET_PATH)) -- GitLab