From 06c27dbfaceca1f2fce7fc2e99785fb040e3bca9 Mon Sep 17 00:00:00 2001
From: Stan Hu <stanhu@gmail.com>
Date: Wed, 15 Jul 2020 17:12:58 -0700
Subject: [PATCH] Exclude development gems from CI builds

We don't need these for tests, and excluding better_errors and
binding_of_caller from the list might get rid of the mysterious seg
faults.

rblineprof is used by `spec/lib/gitlab/sherlock/line_profiler_spec.rb`,
so we need to keep it for testing.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/11951
---
 .gitlab/ci/global.gitlab-ci.yml | 2 +-
 Gemfile                         | 3 ++-
 scripts/prepare_build.sh        | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.gitlab/ci/global.gitlab-ci.yml b/.gitlab/ci/global.gitlab-ci.yml
index 7df8b3f4360dc..3101a42c05838 100644
--- a/.gitlab/ci/global.gitlab-ci.yml
+++ b/.gitlab/ci/global.gitlab-ci.yml
@@ -18,7 +18,7 @@
 
 .rails-cache:
   cache:
-    key: "rails-v1"
+    key: "rails-v2"
     paths:
       - vendor/ruby/
       - vendor/gitaly-ruby/
diff --git a/Gemfile b/Gemfile
index afe408fa99d0e..bdff6e5a75d25 100644
--- a/Gemfile
+++ b/Gemfile
@@ -337,7 +337,6 @@ group :development do
   gem 'danger', '~> 6.0', require: false
 
   gem 'letter_opener_web', '~> 1.3.4'
-  gem 'rblineprof', '~> 0.3.6', platform: :mri, require: false
 
   # Better errors handler
   gem 'better_errors', '~> 2.5.0'
@@ -390,6 +389,8 @@ group :development, :test do
   gem 'png_quantizator', '~> 0.2.1', require: false
 
   gem 'parallel', '~> 1.19', require: false
+
+  gem 'rblineprof', '~> 0.3.6', platform: :mri, require: false
 end
 
 # Gems required in omnibus-gitlab pipeline
diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh
index 4991e8eae451a..a5f8c8b678e1e 100644
--- a/scripts/prepare_build.sh
+++ b/scripts/prepare_build.sh
@@ -2,7 +2,7 @@
 
 export SETUP_DB=${SETUP_DB:-true}
 export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true}
-export BUNDLE_INSTALL_FLAGS="--without=production --jobs=$(nproc) --path=vendor --retry=3 --quiet"
+export BUNDLE_INSTALL_FLAGS="--without=production --without=development --jobs=$(nproc) --path=vendor --retry=3 --quiet"
 
 if [ "$USE_BUNDLE_INSTALL" != "false" ]; then
   bundle --version
-- 
GitLab