Deploy notifier for team messangers like Slack, Mattermost or Teams. Based on https://github.com/parkr/capistrano-slack-notify.
Add this line to your application's Gemfile:
gem 'bot-notifier'And then execute:
$ bundle
Or install it yourself as:
$ gem install bot-notifier
bot-notifier defines two tasks:
Add the following to your Capfile:
require 'bot-notifier'That's it! It'll send 2 messages to #general as the capistrano user when you deploy.
The tasks are:
bn:starting- the intent-to-deploy messagebn:finished- the completion messagebn:failed- the failure messagebn: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 :bn_webhook_url, "https://hooks.slack.com/services/XXX/XXX/XXX"
set :bn_messenger, :mattermost # defaults to :slack, also supports :teams
set :bn_room, '#my_channel' # defaults to #platform
set :bn_username, 'my-company-bot' # defaults to 'capistrano'
set :bn_emoji, ':ghost:' # defaults to :rocket:
set :bn_icon_url, 'https://example.com/bot-icon.png' # optional, for Mattermost
set :deployer, ENV['USER'].capitalize # defaults to ENV['USER']
set :bn_app_name, 'example-app' # defaults to :application
set :bn_color, false # defaults to true
set :bn_destination, fetch(:stage, 'production') # where your code is goingbot-notifier sends webhook requests over HTTPS with TLS peer verification enabled.
Some Ruby/OpenSSL environments (e.g., Ruby 3.4+ with OpenSSL 3.x) may implicitly require CRL (Certificate Revocation List) checks. Ruby does not fetch CRLs automatically; if CRLs are required but missing, you may see:
To control CRL behavior, use:
# Safe default (recommended): TLS verification ON, CRL checks OFF
set :bn_ssl_crl_check, :none
# or legacy switch:
# set :bn_ssl_disable_crl, true
# Optional: enable CRL checks (requires CRLs to be present)
# set :bn_ssl_crl_check, :leaf
# set :bn_ssl_crl_check, :all
# Optional CA locations:
# set :bn_ssl_cert_file, "/etc/ssl/cert.pem"
# set :bn_ssl_cert_dir, "/etc/ssl/certs"This keeps security sane (peer verification stays enabled) while avoiding brittle CRL requirements unless you explicitly opt in.
The gem supports different messenger platforms with their specific message formats:
:slack(default) - Uses Slack's attachment format for colored messages:mattermost- Uses status emojis to indicate message type:- Starting:
:arrow_right: - Success:
:white_check_mark: - Failure/Rollback:
:x: - Info:
:information_source:
- Starting:
:teams- Uses Microsoft Teams' message card format
Each platform has its own way of handling colors and formatting. Set :bn_messenger to match your platform for the best results.
For Mattermost, you can optionally set a custom icon URL using :bn_icon_url. This is useful if you want to use a custom bot icon instead of an emoji.
- Fork it ( https://github.com/WebgateSystems/bot-notifier/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
