From 6f2bf35c9d8c20e9ee9dc35cde581016fddfca68 Mon Sep 17 00:00:00 2001
From: Darius Schneider <schneider@itc.rwth-aachen.de>
Date: Fri, 4 Oct 2024 08:18:29 +0200
Subject: [PATCH] Bundler

---
 rails/gitlab-ci.yml | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/rails/gitlab-ci.yml b/rails/gitlab-ci.yml
index e6aec64..339a367 100644
--- a/rails/gitlab-ci.yml
+++ b/rails/gitlab-ci.yml
@@ -1,7 +1,6 @@
 variables:
   CI: "true"
   RAILS_ENV: test
-  GEM_HOME: vendor/gems
   BUNDLE_PATH: vendor/bundle
 
 set_ruby_version:
@@ -24,9 +23,15 @@ rubocop:
       - vendor/gems
   before_script:
     - wget --quiet "https://git-ce.rwth-aachen.de/noc-public/noc-netze-gitlab-cicd/-/raw/main/rails/rubocop.yml" -O ".rubocop.yml"
-    - gem install --conservative rubocop:1.65.1 rubocop-capybara:2.21.0 rubocop-minitest:0.35.1 rubocop-performance:1.21.1 rubocop-rails:2.25.1 --silent
+    - gem install bundler --silent
+    - bundle add --skip-install --group=test --version=1.65.1 rubocop
+    - bundle add --skip-install --group=test --version=2.21.0 rubocop-capybara
+    - bundle add --skip-install --group=test --version=0.35.1 rubocop-minitest
+    - bundle add --skip-install --group=test --version=1.21.1 rubocop-performance
+    - bundle add --skip-install --group=test --version=2.25.1 rubocop-rails
+    - bundle install --jobs $(nproc) --quiet
   script:
-    - rubocop
+    - bundle exec rubocop
 
 erb_lint:
   stage: test
@@ -40,9 +45,15 @@ erb_lint:
   before_script:
     - wget --quiet "https://git-ce.rwth-aachen.de/noc-public/noc-netze-gitlab-cicd/-/raw/main/rails/rubocop.yml" -O ".rubocop.yml"
     - wget --quiet "https://git-ce.rwth-aachen.de/noc-public/noc-netze-gitlab-cicd/-/raw/main/rails/erb-lint.yml" -O ".erb-lint.yml"
-    - gem install --conservative rubocop:1.65.1 rubocop-capybara:2.21.0 rubocop-minitest:0.35.1 rubocop-performance:1.21.1 rubocop-rails:2.25.1 erb_lint:0.6.0 --silent
+    - gem install bundler --silent
+    - bundle add --skip-install --group=test --version=1.65.1 rubocop
+    - bundle add --skip-install --group=test --version=2.21.0 rubocop-capybara
+    - bundle add --skip-install --group=test --version=0.35.1 rubocop-minitest
+    - bundle add --skip-install --group=test --version=1.21.1 rubocop-performance
+    - bundle add --skip-install --group=test --version=2.25.1 rubocop-rails
+    - bundle install --jobs $(nproc) --quiet
   script:
-    - erblint --lint-all --allow-no-files true
+    - bundle exec erblint --lint-all --allow-no-files true
 
 haml_lint:
   stage: test
@@ -56,9 +67,15 @@ haml_lint:
   before_script:
     - wget --quiet "https://git-ce.rwth-aachen.de/noc-public/noc-netze-gitlab-cicd/-/raw/main/rails/rubocop.yml" -O ".rubocop.yml"
     - wget --quiet "https://git-ce.rwth-aachen.de/noc-public/noc-netze-gitlab-cicd/-/raw/main/rails/haml-lint.yml" -O ".haml-lint.yml"
-    - gem install --conservative rubocop:1.65.1 rubocop-capybara:2.21.0 rubocop-minitest:0.35.1 rubocop-performance:1.21.1 rubocop-rails:2.25.1 haml_lint:0.58.0 --silent
+    - gem install bundler --silent
+    - bundle add --skip-install --group=test --version=1.65.1 rubocop
+    - bundle add --skip-install --group=test --version=2.21.0 rubocop-capybara
+    - bundle add --skip-install --group=test --version=0.35.1 rubocop-minitest
+    - bundle add --skip-install --group=test --version=1.21.1 rubocop-performance
+    - bundle add --skip-install --group=test --version=2.25.1 rubocop-rails
+    - bundle install --jobs $(nproc) --quiet
   script:
-    - haml-lint
+    - bundle exec haml-lint
 
 brakeman:
   stage: test
@@ -71,9 +88,11 @@ brakeman:
       - vendor/gems
   before_script:
     - rm -f ./config/brakeman.yml ./config/brakeman.ignore
-    - gem install --conservative brakeman --silent
+    - gem install bundler
+    - bundle add --skip-install --group=test --version=6.2.1 brakeman
+    - bundle install --jobs $(nproc) --quiet
   script:
-    - brakeman -A --except UnscopedFind
+    - bundle exec brakeman -A --except UnscopedFind
 
 rails_test_all:
   stage: test
@@ -109,6 +128,7 @@ rails_test_all:
       - log/test.log
     expire_in: 1 week
   before_script:
-    - gem install --conservative bundler --silent && bundle install --jobs $(nproc) --quiet
+    - gem install bundler --silent
+    - bundle install --jobs $(nproc) --quiet
   script:
-    - bin/rails db:prepare test:all
+    - bundle exec bin/rails db:prepare test:all
-- 
GitLab