Capistrano 2 deploy notifier for Slack.
Add this line to your application's Gemfile:
gem 'capistrano-slack-notify'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-slack-notify
capistrano-slack-notify
defines two tasks:
Add the following to your Capfile
:
require 'capistrano-slack-notify'
set :slack_webhook_url, "https://hooks.slack.com/services/XXX/XXX/XXX"
before 'deploy', 'slack:starting'
after 'deploy', 'slack:finished'
before 'deploy:rollback', 'slack:failed'
after 'deploy:rollback', 'slack:rolled_back'
That's it! It'll send 2 messages to #general
as the capistrano
user when you deploy.
The tasks are:
slack:starting
- the intent-to-deploy messageslack:finished
- the completion messageslack:failed
- the failure messageslack:rolled_back
- the rollback message
None of the tasks are automatically added, you have to do that yourself, like in the usage example above.
You can optionally set some other parameters to customize the output:
set :slack_room, '#my_channel' # defaults to #platform
set :slack_username, 'my-company-bot' # defaults to 'capistrano'
set :slack_emoji, ':ghost:' # defaults to :rocket:
set :deployer, ENV['USER'].capitalize # defaults to ENV['USER']
set :slack_app_name, 'example-app' # defaults to :application
set :slack_color, false # defaults to true
set :slack_destination, fetch(:stage, 'production') # where your code is going
- Fork it ( https://github.com/parkr/capistrano-slack-notify/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request