August 20, 2021 By Vidyasagar Machupalli 4 min read

Learn how to configure Slack to receive notifications about your Tekton Pipeline.

In this post, you will create a NodeJS Express starter app, configure a DevOps delivery pipeline and integrate Slack into your toolchain to receive notifications whenever there are any updates to the Tekton pipeline. 

Before you begin, let’s quickly learn about Tekton and Slack,

What is Tekton?

Tekton is an open-source, vendor-neutral framework for creating continuous integration and delivery (CI/CD) systems, governed by the Continuous Delivery Foundation (CDF). As a Kubernetes-native framework, Tekton helps to modernize continuous delivery by providing industry specifications for pipelines, workflows, and other building blocks — making deployment across multiple cloud providers or hybrid environments faster and easier.

IBM provides a seamlessly managed CI/CD experience with Tekton pipelines in IBM Cloud Continuous Delivery toolchains, so you can deliver cloud-native applications across multiple cloud providers or on-premises systems, monitored by an integrated dashboard.

Now, let’s understand a bit about Slack

What is Slack?

Slack is a cloud-based, real-time messaging and notification system. Slack provides persistent chat, which is a more interactive alternative to email for team collaboration. You can communicate with your team on a dedicated channel or on a set of channels that is directly related to your work. The communications in direct messages and on channels are retained so that you can search them.

Notifications that are posted to public Slack channels are visible to everyone on the team.  You can configure Slack to receive notifications about your toolchain from the in-built tool integrations.

Prerequisites 

Create a starter application

IBM Cloud App development offers a selection of starter applications to generate all the necessary boilerplate, build and configuration code so that you can start coding business logic faster:

  1. From the IBM Cloud console, use the left-side menu option and select App Development.
  2. Click Starter Kits.
  3. Select the Node.js Express App tile, click on Get Started and then Create app to create a Node.js starter application.
  4. Enter a unique name for the application, such as <your-initials>-nodejs-code-engine-app, and select a resource group. Then, click Create.

Configure DevOps delivery pipeline

Now that you successfully created the starter application, you can automate its deployment to the Code Engine project.

IBM Cloud Code Engine is a fully managed, serverless platform that runs your containerized workloads, including web apps, microservices, event-driven functions or batch jobs. Code Engine even builds container images for you from your source code. Because these workloads are all hosted within the same Kubernetes infrastructure, all of them can seamlessly work together. The Code Engine experience is designed so that you can focus on writing code and not on the infrastructure that is needed to host it:

  1. Under the Deployment Automation tile, click on Deploy your app.
  2. Select Code Engine as the Deployment target. The other targets are Kubernetes Service, Red Hat OpenShift and Cloud Foundry.
  3. Provide an IBM Cloud API Key. If you don’t have one, create one by clicking on New.
  4. Select a Container registry region and a Container registry namespace.
  5. Select a region same as your Code Engine project in which to create your toolchain.
  6. Select the Code Engine project name you created earlier.
  7. Click Next:
  8. Change the DevOps toolchain name if you wish to, check the region and click on Create.
  9. Click on the name of the toolchain under Deployment Automation to see the overview page of the toolchain.

Configure Slack to receive notifications about your toolchain 

A toolchain is a set of tool integrations that support development, deployment and operations tasks. The collective power of a toolchain is greater than the sum of its individual tool integrations:

  1. On the Overview page of your toolchain, click on Add tool.
  2. Click Communication on the left pane and then click on the Slack tile.
  3. On the configure Slack page, enter the Webhook URL under Slack Webhook and the Slack channel name (without #). You can always find the Slack Webhook URL and channel name under the Incoming Webhooks page of your Slack app.
  4. For the Slack team name, navigate to the Slack app and click on the workspace name on the top-left corner, as shown in the screenshot below. Enter the name without .slack.com. For example, the Slack team name is test-zam6729 .
  5. Click on Create integration. You should see message Webhook configuration details in the channel you specified, creating the Slack integration as shown in the image below:

Configure the delivery pipeline to send notifications to Slack

  1. Under the Overview page of your toolchain, click on Delivery pipeline and the ci-pipeline tile.
  2. On the left pane, click on Definitions.
  3. Click on Add for a new definition:
    • Under repository, select <toolchain-name>-tekton-catalog
    • Branch: master
    • Path: slack
    • Click on Add
  4. ​​​​​​​Repeat Step 3 with Path: slack/sample.
  5. You should now see two new definitions added pointing to slack and slack/sample.
  6. You can validate the pipeline definition by clicking Validate to seeNo errors or warnings detected.”
  7. Click on Save.
  8. Navigate to Settings, switch Slack notifications to On and click Save.
  9. Click on Run Pipeline to trigger the toolchain and then click on Run.

The code update triggers a build, but to quickly test whether the Slack integration is working, you can create a manual trigger to start the sample listener by following these steps:

  1. Click on Triggers > Add Trigger > Manual:
    • EventListener: event-listener-post-slack
    • Click on Save
  2. Click on Run Pipeline > Select Manual Trigger – 1 and then click on Run:

You can cross-check the Slack messages with the PipelineRuns, as shown below: 

What’s next?

If you have any queries, feel free to reach out to me on Twitter or on LinkedIn

Was this article helpful?
YesNo

More from Cloud

How fintechs are helping banks accelerate innovation while navigating global regulations

4 min read - Financial institutions are partnering with technology firms—from cloud providers to fintechs—to adopt innovations that help them stay competitive, remain agile and improve the customer experience. However, the biggest hurdle to adopting new technologies is security and regulatory compliance. While third and fourth parties have the potential to introduce risk, they can also be the solution. As enterprises undergo their modernization journeys, fintechs are redefining digital transformation in ways that have never been seen before. This includes using hybrid cloud and…

IBM Cloud expands its VPC operations in Dallas, Texas

3 min read - Everything is bigger in Texas—including the IBM Cloud® Network footprint. Today, IBM Cloud opened its 10th data center in Dallas, Texas, in support of their virtual private cloud (VPC) operations. DAL14, the new addition, is the fourth availability zone in the IBM Cloud area of Dallas, Texas. It complements the existing setup, which includes two network points of presence (PoPs), one federal data center, and one single-zone region (SZR). The facility is designed to help customers use technology such as…

Apache Kafka use cases: Driving innovation across diverse industries

6 min read - Apache Kafka is an open-source, distributed streaming platform that allows developers to build real-time, event-driven applications. With Apache Kafka, developers can build applications that continuously use streaming data records and deliver real-time experiences to users. Whether checking an account balance, streaming Netflix or browsing LinkedIn, today’s users expect near real-time experiences from apps. Apache Kafka’s event-driven architecture was designed to store data and broadcast events in real-time, making it both a message broker and a storage unit that enables real-time…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters