Select Page
by

Vardhan NS

|
last updated on September 3, 2021
Share

Background:

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 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), 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”

Create App on Slack for Spinnaker CD pipeline

 Create App in Slack for Spinnaker CD pipeline

3. Enter App name & Workspace to which app is to be installed

Enter the App name in Slack for the Spinnaker CD pipeline

 Enter the App name in Slack for the Spinnaker CD pipeline

Select Bot in the list of features in Slack

 Locate the Bots in the list of features in Slack

 4. Select Bot in the list of features and tools as shown below.  

Select Bot in the list of features in Slack

 Select Bot in the list of features in Slack

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

Set up the privileges in Slack for reading and writing by the App for Spinnaker

 Set up the privileges in Slack for reading and writing by the App for Spinnaker

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

Allow newly created app for Spinnaker to access the Slack workspace

 Allow newly created app for Spinnaker to access the Slack workspace

 9. You’ll be redirected to “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 notification medium to halyard configuration

Insert the Bot token for OAuth authentication

 Insert the Bot token for OAuth authentication

  10. Now go back to App Home Section and check the button “Always show my Bot as Online”

“Always show my Bot as Online”

 “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:

Creating a new channel to receive Slack notifications

 Creating a new channel to receive Slack notifications

 12. Execute 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

Set Notification using the Slack option

Set Notification using the Slack option

Custom edit Notification

Custom edit Notification    

Note: It is required to invite/add the newly created app to the channel where you wish to receive the notifications.  

14. TADAA! There you go, a notification with a link to the pipeline in the slack channel.

View notification with a link to the pipeline in the slack channel

View notification with a link to the pipeline in the slack channel


If you want to know more about Spinnaker or request a demonstration, please book a meeting with us.

OpsMx is a leading provider of Continuous Delivery solutions that help enterprises safely deliver software at scale and without any human intervention. We help engineering teams take the risk and manual effort out of releasing innovations at the speed of modern business. For additional information, contact us

Vardhan NS

Vardhan is a technologist and a marketing professional, currently working as a Sr. PMM at OpsMx. His strength lies in understanding complex technologies, and explaining them in un-complicated ways. Vardhan is a passionate Product Marketer with a keen focus on Content, helping brands Position themselves uniquely with clear messaging and competitive differentiation. Outside of work, he is an athlete that is passionate about Football, Swimming and Surfing.

Link

1 Comment

  1. Sandeep

    I have been trying to add a user group in the message, so that only them will get notified.. but however the user group is read as a normal text and the users are not notified in slack.. any idea on how this can be achieved.

    Sample Message:
    @tiger Deployment completed

    Reply

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.