The Blog

Apr 19
1

Capistrano and Campfire After-Deploy Hook For The Lulz

by David Czarnecki

We recently started using capistrano-mountaintop to announce when deploys to our environments are taking place. This morning, @andkjar noted that it’d be nice to see if the deploy was successful or not since it pastes the deploy log and it’s long enough that you might not see whether or not the deploy was successful. This simple addition to deploy.rb checks the deploy log for success or failure and pastes an appropriate image into our Campfire room.

after 'deploy', 'agora:campfire:success_or_failure'
namespace :agora do
  namespace :campfire do
    task :success_or_failure do
      log = fetch(:full_log)
      if log.include?('Rolling back')
        campfire_room.speak 'http://i.imgur.com/XNCA1.png'
      else
        campfire_room.speak 'http://i.imgur.com/oYeMx.png'
      end
    end
  end
end

view raw gistfile1.txt This Gist brought to you by GitHub.

Success results in:

Failure results in:

You can find more hilarity over on my Twitter account, CzarneckiD.

  • Reddit
  • Digg
  • del.icio.us
  • Facebook
  • Tumblr
  • Twitter

Comments

  1. Those pictures are pretty funny.

Leave a Reply

*