The cookbooks currently only install rvm for the
hudson user, but each job is in charge of sourcing RVM and using the appropriate version. To do this you will not be able to use any of the ruby-specific build task plugins (such as the rake task plugin). Instead, you must create a build shell task to use rvm and then invoke rake or whatever you need. Such as:
#!/bin/bash source ~/.rvm/scripts/rvm && rvm use 1.8.7-p248 && rake spec
Often times you will want to run
bundle or a series of other rake commands. You can do this all in the same script like so:
#!/bin/bash source ~/.rvm/scripts/rvm && rvm use 1.8.7-p248 && bundle install && rake spec
Or, you may want to create separate build tasks. (Although, I don’t see much apparent advantage in doing that.) Here is an example of creating different build tasks:
Included with the hudson recipe is hudson::headless which provides a headless browser via Xvfb and Firefox. This has been tested and works with capybara and selenium-webdriver. It will probably work with webrat too.
#!/bin/bash export DISPLAY=:99 source ~/.rvm/scripts/rvm && rvm use 1.8.7-p248 && bundle install && /etc/init.d/xvfb start && rake cucumber RESULT=$? /etc/init.d/xvfb stop exit $RESULT
Headless Cucumbers and Capybaras with Selenium and Hudson was the inspiration for the hudson::headless recipe.
Most likely your problem is with authorization. If you are using git over
ssh you need to copy the appropriate private key to
/home/hudson/.ssh/. You will also need to
ssh in and manually clone a repository once so you can verify the key’s fingerprint (this will add the git server to the known_hosts file).