Automatic Staging Deploy with Hudson CI, RSpec and Capistrano
Wednesday, November 17, 2010
Note: This was solution was hacked together in 30 minutes, theres a better way of doing it, I just havent followed through with it yet. Will update this article when I’ve done so.
We have a staging server at desksnear.me. Having to deploy to this server manually is annoying as hell - so I wanted to setup our CI server to automatically deploy to staging after a successful build.
After some research, I stumbled across this Hudson plugin: http://wiki.hudson-ci.org/display/HUDSON/Post+build+task. “This plugin allows the user to execute a shell/batch task depending on the build log output.Java regular expression are allowed.”
After you’ve installed the plugin, you’ll get access to a new “Post build task” checkbox under the “Post-build actions”. Fill in the blanks as per the image below:

Replace “cap staging deploy” with your command to deploy to staging. This solution only works with RSpec at the moment. The “Log text” should only match if all your tests pass - if they fail - that regular expression wont match, and therefor wont run your “cap staging deploy” command.

