This seems to be the same issue as JENKINS-7947 but I decided to raise a new issue rather than try to reopen the old one.
jenkins user has been added to rvm group
Console error from job when configured to run with rake-plugin:
[devtest] $ /usr/local/rvm/rubies/ruby-2.0.0-p643/bin/rake -T
/usr/bin/env: ruby: No such file or directory
Build step 'Invoke Rake' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE
Running the job via shell with this configuration works as expected:
source /etc/profile.d/rvm.sh &> /dev/null
bundle install
rake --version
ruby --version
rake -T
And produces this output:
[devtest] $ /bin/bash -xe /tmp/hudson5194824731866794680.sh
+ source /etc/profile.d/rvm.sh
+ bundle install
Using rake 10.4.2
Using hostlist_expression 0.2.1
Using oj 2.12.13
Using multi_json 1.11.2
Using rspec-support 3.3.0
Using rspec-core 3.3.2
Using diff-lcs 1.2.5
Using rspec-expectations 3.3.1
Using rspec-mocks 3.3.2
Using rspec 3.3.0
Using rspec-its 1.2.0
Using net-ssh 2.9.2
Using net-scp 1.2.1
Using net-telnet 0.1.1
Using sfl 2.2
Using specinfra 2.43.2
Using serverspec 2.23.1
Using ansible_spec 0.2.1
Using bundler 1.10.6
Bundle complete! 12 Gemfile dependencies, 19 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
+ rake --version
rake, version 10.4.2
+ ruby --version
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
+ rake serverspec:test-playbook
Run serverspec for test-playbook to devtest