0.0
No commit activity in last 3 years
No release in over 3 years
Notification hooks include start, finish and fail of deployments.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Capistrano::Hook

Gem Version Build Status Code Climate

Notification hooks include start, finish and fail of deployments.

Features

Webhoook

Notify Capistrano deployments via webhook API. Just set the webhook URL and message.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-hook'

Usage

Add this line to your Capfile:

require 'capistrano/hook'

Notification will not be run with no settings. You can setting the variables shown below.

set :webhook_url, 'https://yulii.github.io/services'
set :webhook_starting_payload,   { text: 'Now, deploying...' }
set :webhook_finished_payload,   { text: 'Deployment has been completed!' }
set :webhook_failed_payload,     { text: 'Oops! something went wrong.' }
set :webhook_reverting_payload,  { text: 'Reverting...' }
set :webhook_rollbacked_payload, { text: 'Rollback has been completed!' }

See capistrano-hook/config

Testing

Test your setup by running:

# List the webhook configured variables
$ cap production webhook:config:list

# Post a starting message
$ cap production webhook:post:starting

# Post a finished message
$ cap production webhook:post:finished

# Post a failed message
$ cap production webhook:post:failed

# Post a reverting message
$ cap production webhook:post:reverting

# Post a rollbacked message
$ cap production webhook:post:rollbacked

If you want to see all capistrano hook commands, please run cap -T. :)

Example

Slack incoming webhook

Send notifications to Slack via incoming webhook.

Slack API - Incoming Webhooks

set :webhook_url, '#{YOUR WEBHOOK URL}'
set :webhook_starting_payload, {
  username:   'Capistrano',
  icon_emoji: ':rocket:',
  text:       'Now, deploying...'
}
set :webhook_finished_payload, {
  username:   'Capistrano',
  icon_emoji: ':rocket:',
  text:       'Deployment has been completed!'
}
set :webhook_failed_payload, {
  username:   'Capistrano',
  icon_emoji: ':rotating_light:',
  text:       'Oops! something went wrong.'
}

Contributing

Fork, fix, then send a pull request and attach test code.

License

The gem is available as open source under the terms of the MIT License.