11 software delivery problems solved by intelligence software delivery platform  Download
Select Page

Microsoft Teams Integration with Spinnaker

Raghuram M March 11, 2021
Share

In Continuous Delivery, a faster feedback loop ensures quicker identification and resolution of bugs, audits, and approvals of the CI/CD pipeline stages in Spinnaker or other CD tools.  

Microsoft Teams is a proprietary business communication and collaboration platform. DevOps teams often use MS Teams for workspace collaboration, communication, shared file storage, and application integration.

Why do we need to integrate Microsoft Teams in the Spinnaker CI/CD pipelines?

Every software delivery business needs a high-release cadence. Organizations need to have the proper insight, and approvals in place before releasing any applications into the production environments while using Spinnaker CI/CD pipelines. The release items need to undergo various testing and approvals processes before going into production and we need to know the execution status of the Spinnaker pipelines for proper “SignOff Approvals” from each and every release team member with approval authority. In order to have a smooth and continuous ongoing release process, we need to have a good feedback system like MS Teams.

Spinnaker CD (Continuous Delivery) makes life easier for the busy release teams in automating production releases, and with the capability to integrate with MS Teams, it automates approval of CI/CD pipeline stages. Thus, we can have a much easier release process with all the required approvals in place.

In this blog, we will discuss how Spinnaker can be integrated with MS Teams to instill a feedback mechanism in your CI/CD pipeline

Prerequisites 

Spinnaker 1.23 and later versions support sending notifications to Microsoft Teams using incoming Webhooks.

Enable Microsoft Teams for Spinnaker CI/CD pipelines

To enable Microsoft Teams to support, add the following statement to the ~/.hal/default/profiles/echo-local.yml file inside the Halyard pod.

When HA is enabled, create a ~/.hal/default/profiles/echo-worker-local.yml file inside the Halyard pod and add contents as shown below:

$ kubectl exec -it <pod-name> -n <namespace> -- bash

$ vim ~/.hal/default/profiles/echo-local.yml 

microsoftteams:

  enabled: true

:wq!

$ hal deploy apply

Create Microsoft Teams Incoming Webhook URL:

To create a custom Incoming Webhook in Teams, follow the instructions provided below:

    1. Navigate to the Directory in MS Teams. Select (•••) “More Options” from the top navigation bar and select Add Channel and configure the same.
      Add channel in MS teams

      Add channel in MS teams

      Create your channel for Spinnaker notifications

      Create your channel for Spinnaker notifications

    2. Select the channel you just created and then choose Connectors from the drop-down menu by clicking the (•••) icon and search for Incoming Webhook.
      Choose Connectors for the Channel created

      Choose Connectors for the Channel created

      Select Incoming WebHook from the list of available Connectors

      Select Incoming Webhook from the list of available Connectors

    3. Select the Configure button, provide a name, and, optionally, upload an image avatar for your Webhook.
      Configure the Incoming WebHook Connector

      Configure the Incoming Webhook Connector

    4. The dialog window will present a unique URL that will map the channel. Make sure that you copy and save the URL (You will need to provide it to the outside service).
    5. Select the Done button. The Webhook will be available in the MS Teams channel.
      Copy the WebHook URL

      Copy the Webhook URL

Sample URL: https://azureaccountopsmx.webhook.office.com/webhookb2/493204dc-87d9-411c-b1b0-1ca669457ea3@d1ea7473-64d0-44ed-a093-ad8041071ee6/IncomingWebhook/782c53e7e8ff4d59a9fb5381asknxskjdnjefhjnfj-4f28-a95a-94835c78d038 

Spinnaker will expect the URL to be in a specific format and it trimming off everything into a standard format URL as shown below

Modified URL for the above URL, as modified by Spinnaker:
https://outlook.office.com/webhook/493204dc-87d9-411c-b1b0-1ca669457ea3@d1ea7473-64d0-44ed-a093-ad8041071ee6/IncomingWebhook/782c53e7e8ff4d59a9fb5381asknxskjdnjefhjnfj-4f28-a95a-94835c78d038

Spinnaker expects URLs to be 35 characters long including ‘/ ‘ and all of the credentials come after that.

Examplehttps://outlook.office.com/webhook/ → 35 characters long and rest is credentials

URL modification is done by spinnaker and you can edit the URL but make sure it should have 35 characters including ‘/’ and all the credentials come after that.

Recommended Way: Copy the URL that you generated from MS Teams and paste it in Spinnaker as defined in Adding Webhook URL into the Spinnaker section below and start the job. Once the job is initiated, check the logs of echo-pod and there you will be able to see the following message:

$ kubectl logs <echo-pod-name> -n <namespace> 

When HA is enabled, look for logs from <echo-worker-pod-name>

$ kubectl logs <echo-worker-pod-name> -n <namespace>

2021-02-24 08:09:39.184  INFO 1 — [RxIoScheduler-3] .n.s.e.n.MicrosoftTeamsNotificationAgent : Building Microsoft Teams notification

2021-02-24 08:09:39.185  INFO 1 — [RxIoScheduler-3] .n.s.e.n.MicrosoftTeamsNotificationAgent : Sending Microsoft Teams notification

2021-02-24 08:09:39.192  INFO 1 — [RxIoScheduler-3] c.n.s.e.m.MicrosoftTeamsClient    : —> HTTP POST

https://outlook.office.com/webhook/ffice.com/webhookb2/493204dc-87d9-411c-b1b0-1ca669457ea3@d1ea7473-64d0-44ed-a093-ad8041071ee6/IncomingWebhook/782c53e7e8ff4d59a9fb5381d116a81d/d022d73f-6ae4-4f28-a95a-94835c78d038

2021-02-24 08:09:39.326 ERROR 1 — [RxIoScheduler-3] .n.s.e.n. MicrosoftTeamsNotificationAgent: failed to send Microsoft teams message

Highlighted link from the above logs of the echo pod is the modified version of the provided Webhook URL as modified by Spinnaker. Copy that link and paste it in the MS Teams Webhook URL section in Spinnaker. That’s it, your MS Teams channel is now configured to receive Spinnaker pipeline execution notifications.

Steps to add Webhook URL in Spinnaker:

When configuring a Microsoft Teams notification, enter the full incoming Webhook URL in the MS Teams Webhook URL text box. 

  1. Go to the Spinnaker application. 
  2. You can define notifications at the Application level as well as the Pipeline level of the Application.
  3. Select the Application and go to the Pipeline for which notifications have to be sent.
  4. Navigate to the Notifications and select Add Notification Preference
  5. Select Microsoft Teams under the dropdown “Notify via”.
  6. Paste the URL at the Teams Webhook URL section.
  7. Check the boxes, what you have to get notified w.r.t the pipeline/Application and update.
    Configure MS Teams notifications in Spinnaker

    Configure MS Teams notifications in Spinnaker

Once a job is initiated as defined then the notifications will be sent to the respective channel of Microsoft Teams.

Stage-wise Notifications

Stage-wise Notifications

From MS Teams you can navigate back to Spinnaker by clicking on View Execution and see the job status in Spinnaker.

So here in this blog, we have shown you how to integrate MS Teams with Spinnaker in order to generate custom notifications for different stages when the Spinnaker pipelines are executed. Now go ahead and give it a try yourself. If you face any difficulties feel free to comment or contact our support team.

The following articles can be interesting for you:

  1. ServiceNow Integration
  2. Slack Integration

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.

Iocn

Raghuram M

Raghuram M is a DevOps Engineer at OpsMx. He has over 6+ years of experience in the IT industry, with expertise in Kubernetes, AWS cloud, Linux, and DevOps areas. He has certifications in Certified Kubernetes Administrator (CKA), AWS Certified Solution Architect - Associate (SAA), RedHat Certified Engineer (RHCE), RedHat Certified System Administrator (RHCSA), ITIL® Foundation Certified. Prior to OpsMx, he had worked at Rakuten India Enterprise Pvt Ltd, DXC.Technologies(HP), and Zenith Computers.

You May Like