How Do I Use a Custom Ruby Version When Using the Machine Executor?

When using the machine executor, RVM is available for easy installation and use of custom ruby versions.

To get this going, add a step like the following:

      steps:
- run:
name: Set ruby version to 2.3.4
command: |
rvm install 2.3.4
echo . $(rvm 2.3.4 do rvm env --path) >> $BASH_ENV

After this step runs, the new ruby version will be in place.

Alternatively, you can also use the Ruby Orb to install and set the Ruby version. Ensure you are on version 1.1.2 or later. You can set and invoke the Orb like the following:

...
orbs:
  ruby: circleci/ruby@1.1.2

jobs:
  deploy:
    machine:
      image: ubuntu-1604:202004-01
    steps:
      - ruby/install:
          version: '2.7'
Was this article helpful?
4 out of 8 found this helpful

Comments

0 comments

Article is closed for comments.