Spinnaker — Slack Integration
Slack being a predominant business communication & collaboration platform, organisations 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 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 a deployment is happening to a service in production, and whether or not it completed successfully. In case a pipeline fails, they could simply click on the link in the notification and check for the reason behind failure.
In this blog let us look at how we can configure spinnaker to receive pipeline notifications to a slack channel.
- Slack Workspace
- Access to Halyard
We need to have a slack bot that can automatically post notifications in a channel and spinnaker shall be aware of the the bot’s identity(name & token). So, in the initial few steps we will be creating an app(bot), add/invite 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. Visit https://api.slack.com/apps
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 same screen
8. Allow newly created app to access slack workspace
9. You’ll be redirected to Oauth & Permission section wherein you will see below screen. Copy the Bot User OAuth Access Token which shall be used to add slack as 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 below hal commands to add slack as notification medium
export SPINNAKER_BOT=spinnakernotifybothal config notification slack enableecho $TOKEN_FROM_SLACK | hal config notification slack edit --bot-name $SPINNAKER_BOT --tokenhal deploy apply
Note: Wait for the echo & deck pods to be up and running as they will be restarted after configuration.
13. Now you will see a slack option in the notifications section.
Note: It is required to invite/add newly created app to the channel where you wish to receive the notifications.
14. TADAA! There you go, a notification with a link to pipeline in the slack channel
You may want to visit OpsMx website for many such interesting blogs