Gitlab CI/CD Job fails when installing Bundler

Viewed 256

I want to run the tests after every commit. When installing the bundler, however, the following error message appears: "You must use Bundler 2 or greater with this lockfile" although I install version 2.2.5

stages:
  - test
test-job:
  stage: test
  image: ruby:2.5.1
  script:
    - gem install bundler -v 2.2.5
    - bundle install
    - bundle exec rails test

enter image description here

1 Answers

bundler 1.16.6 is included in ruby:2.5.1 and is used per default as you can see here:

$ gem list bundler
bundler (2.2.5, 1.16.6, default: 1.16.2)

Try this instead:

test-job:
  stage: test
  image: ruby:2.5.1
  before_script:
    - gem update --system
  script:
    - bundle install
    - bundle exec rails test
Related