Using a specific version of Bundler

I have the following in my action:


- "bin/bundle install"

- "bin/bundle exec rspec"


- "gem install bundler"

However, when bundle install is ran on the pipeline, I get the error

You must use Bundler 2 or greater with this lockfile.

I can see that bundler 2 is being installed before bundle install is being invoked:

Successfully installed bundler-2.0.2

Am I missing something?

Full output:

Pulling image library/ruby:2.3.7

Creating image started.

Sending build context to Docker daemon 2.048kB

Step 1/2 : FROM library/ruby:2.3.7

—> 205d0fa463d7

Step 2/2 : RUN gem install bundler

—> Running in 5627c2bfbfde

Successfully installed bundler-2.0.2

1 gem installed

Removing intermediate container 5627c2bfbfde

—> 2982c2380205

Successfully built 2982c2380205

Successfully tagged buddy/3fb565ada919425e09f8d7446e4336dc:1.0

Creating image finished.

EXECUTEbin/bundle install

You must use Bundler 2 or greater with this lockfile.

FAILEDAction failed: see logs above for details

Had exactly the same problem. The solution was to use a newer Ruby container (say 2.6.5). The default of Ruby 2.3 seems to always exhibit this behaviour.

You can update your Ruby container version in the Environment tab of the action.