Skip to content

Send Capistrano deployment status to Slack via the Incoming Webhooks integration

License

Notifications You must be signed in to change notification settings

chubchenko/capistrano-slacky

Repository files navigation

gem version build downloads

capistrano-slacky

Send Capistrano deployment status to Slack via the Incoming Webhooks integration.

  • Messages are built on the basis of the Block Kit. See Demo section.
  • Fires after every successful/failed deployment or rollback.
  • Use Incoming Webhook URL from the remote server.
  • Send commit log between 2 deployments.

Table of Contents

Requirements

  • Ruby >= 3.0
  • Capistrano ~> 3.0
  • Slack

Installation

Add the following line to your Gemfile:

gem "capistrano-slacky", "~> 0.1", require: false

And then execute:

bundle install

Configuration

Out of the box, the gem has a default configuration:

set :slacky,
  username: "ChatOps", # Set your bot's user name.
  icon_emoji: ":robot_face:", # Emoji to use as the icon for this message.
  channel: "#deployment", # The name of the channel to send a message to.
  klass: Capistrano::Slacky::Messaging::Default # The class that responsible for creating a message.

So you can easily tweak your deployment messages and all other configuration to what you want.

Usage

Require the library in your application's Capfile

require "capistrano/slacky"
  • Add an Incoming Webhooks to your Slack.
  • The received Incoming Webhook URL must be uploaded to the remote server. It should be stored in a shared directory under the following path config/slacky.yml.
  • Run cap production slacky:ping command to test your integration.

That's all, deploy your application as usual and you will see a deployment notification in your Slack channel.

In case if you want to disable deployment notifications for a specific stage just set slacky to false.

set :slacky, false

Demo

Deployed successfully

Reverted successfully

Supported Ruby Versions

This library aims to support and is tested against the following Ruby implementations:

  • Ruby 3.0
  • Ruby 3.1
  • Ruby 3.2
  • Ruby 3.3

If something doesn't work on one of these Ruby versions, it's a bug.

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked, and/or a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:

gem "capistrano-slacky", "~> 0.1"

License

MIT

About

Send Capistrano deployment status to Slack via the Incoming Webhooks integration

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages