2

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

Raswidr
  • 186
  • 6
  • You can since you are installing a specific version of bundler you can also specify that version for bundle commands. See [This SO Post](https://stackoverflow.com/a/12093575/1978251) for more info – engineersmnky Sep 09 '21 at 15:11

1 Answers1

1

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
slauth
  • 2,667
  • 1
  • 10
  • 18
  • I tried your answer but it doesn't work: ```RubyGems installed the following executables: /usr/local/bin/gem /usr/local/bin/bundle /usr/local/bin/bundler RubyGems system software updated $ bundle install You must use Bundler 2 or greater with this lockfile. Cleaning up file based variables 00:01 ERROR: Job failed: exit code 1``` – Raswidr Sep 09 '21 at 08:42