Firstly, you'll need to install rvm as the buildkite-agent user:
sudo su buildkite-agent
curl -sSL https://get.rvm.io | bash -s stable
source /var/lib/buildkite-agent/.rvm/scripts/rvm
rvm install 2.4.0 && rvm use 2.4.0 && gem install bundlerSecondly, make rvm available to your build commands by adding the following pre-command Buildkite Agent hook: