OpsMx
Ask or search…
K
Links

Configure Slack notifications

Overview

Slack being a predominant business communication & collaboration platform, organizations are solely relying on Slack for collaboration, then why not receive notifications on the same platform? Slack integrates with almost all the widely used tools such as GitHub, Jira, Google Apps, Salesforce, etc. Spinnaker also supports sending CI/CD pipeline notifications to slack. Receiving notifications on slack over email is preferred for a wide range of reasons. Team members who are on-call can be alerted that deployment is happening to service in production, and whether or not it is completed successfully. In case a pipeline fails, they could simply click on the link in the notification and check for the reason behind the failure. In this blog let us look at how we can configure spinnaker to receive pipeline notifications to a Slack channel.

Prerequisites

  • Slack Workspace
  • Access to Halyard

Instructions

We need to have a Slack bot that can automatically post notifications in a channel and the Spinnaker shall be aware of the bot’s identity (name & token). So, in the initial few steps, we will be creating an app(bot), adding/inviting it to a Slack channel, and later we will proceed to configure spinnaker to send notifications to Slack. Let’s dive into the quick and easy process to get notified over slack.
  1. 2.
    Click on “Create an App
3. Enter App name & Workspace to which app is to be installed
4. Select Bot in the list of features and tools as shown below.
5. In the “App Home” section, click on “Review Scopes to Add
6. Add necessary scope as shown below; it is mandatory to add chat: write to send notifications to a Slack channel
7. Click on “Install App to Workspace” which is at the top of the same screen
8. Allow newly created app to access the Slack workspace
9. You’ll be redirected to the “OAuth & Permission” section wherein you will see the below screen. Copy the Bot User OAuth Access Token which shall be used to add slack as a notification medium to halyard configuration.
10. Now go back to App Home Section and check the button “Always show my Bot as Online
11. Now go to your slack workspace and add the newly created “App” to a channel to which notifications are expected to receive Here I’m creating a new channel to receive Slack notifications as shown below:
12. Execute the below hal commands to add slack as notification medium https://spinnaker.io/setup/features/notifications/#slack
Export TOKEN_FROM_SLACK= "xoxb-661456xxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx"
Export SPINNAKER_BOT= spinnakernotifybot hal config notification slack enable echo
$TOKEN_FROM_SLACK | hal config notification slack edit --bot-name $SPINNAKER_BOT --token hal deploy apply
Note: Wait for the echo & deck services to be up and running
13. Now you will see a slack option in the notifications section
Note: It is required to invite/add the newly created app to the channel where you wish to receive the notifications.
14. Here you go, a notification with a link to the pipeline in the slack channel.