When I run a shell script in Jenkins, I do something like
#!/bin/bash
echo '##################### BUNDLE/MIGRATION #####################'
source ~/.bashrc
rvm use 2.1@gemset
bundle install
bundle exec rake db:schema:load RAILS_ENV=test
bundle exec rake db:test:prepare
I my .bashrc
I have the lines
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PATH=$PATH:$HOME/.rvm/bin
I do not know if this is the state of the art, but it works :-)