Slack

VSTS Bot – First Thoughts

So I recently read about the new VSTS Slack Bot.  This type of automation really gets me pumped as it aligns with one of my core DevOps principles, automation!!

So it pretty easy to setup.

  • Hit this page and click the Add to Slack button.
  • You will then need to get your access code from with your VSTS account and type it into the Slack Bot

From there you can do things like view\create a Release by typing “Releases” and then clicking the “Create” button. (GH-LunchMenuAction = My Release for my Google Home Action)

slackvstsbot2.png

You can also view approvals and launch builds.

slackvstsbot

Kind of a cool little add-on from Microsoft.  It’ll will be interesting to see what functionality is added in the future.

Note – Stuff like this is why I would recommend going with VSTS and not TFS on-premise.  Eventually VSTS will have all TFS on-premise features, plus its cheaper and you get updates hassle free….  Its only a matter of time.

Slack – Notification – PowerShell

I recently started using Slack more, specifically with custom notifications sent from outside Slack to my Slack channel.

There are many different ways to do this.  For this blog post, I will show you how I setup message sending with PowerShell.

PowerShell (Super Easy!)

  1. Use the PSSlack module to make things easy.
  2. Install this module on your server\workstation.
  3. Obtain your legacy token from here for your Slack instance.
  4. Setup your VS PowerShell project.  (Unreliable VS 2015 PS add-in)
  5. Write some easy code and have a tool like Jenkins run the program as needed!
    • Note, you will need to set the Token variable yourself.
    • You can select your message emoji from this list.
New-SlackMessageAttachment -Color $_PSSlackColorMap.green `
 -Title 'The Flask Build Deployment Passed' `
 -TitleLink https://www.devopsunleashed.com `
 -Text 'Great job!' `
 -Pretext 'Build Deployment Alert' `
 -AuthorName 'DevOpsUnleashed' `
 -AuthorIcon 'IMAGE_PATH_HERE' `
 -Fallback 'Your client is bad' |
New-SlackMessage -Channel '#build-results-flask' -Username "Build Notifier" `
 -IconEmoji :checkered_flag: |
Send-SlackMessage -Token $Token

You should get a nice message to your Slack channel!

Slack1

One of my main attributes of a good DevOps team is collaboration, the other being automation.  Slack is a great tool to assist in improving collaboration, and even allows for some cool automation!

slack-2014