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

Bigger isn’t always better: How hybrid AI pattern enables smaller language models

5 min read - As large language models (LLMs) have entered the common vernacular, people have discovered how to use apps that access them. Modern AI tools can generate, create, summarize, translate, classify and even converse. Tools in the generative AI domain allow us to generate responses to prompts after learning from existing artifacts. One area that has not seen much innovation is at the far edge and on constrained devices. We see some versions of AI apps running locally on mobile devices with…

IBM Tech Now: April 8, 2024

< 1 min read - ​Welcome IBM Tech Now, our video web series featuring the latest and greatest news and announcements in the world of technology. Make sure you subscribe to our YouTube channel to be notified every time a new IBM Tech Now video is published. IBM Tech Now: Episode 96 On this episode, we're covering the following topics: IBM Cloud Logs A collaboration with IBM watsonx.ai and Anaconda IBM offerings in the G2 Spring Reports Stay plugged in You can check out the…

The advantages and disadvantages of private cloud 

6 min read - The popularity of private cloud is growing, primarily driven by the need for greater data security. Across industries like education, retail and government, organizations are choosing private cloud settings to conduct business use cases involving workloads with sensitive information and to comply with data privacy and compliance needs. In a report from Technavio (link resides outside ibm.com), the private cloud services market size is estimated to grow at a CAGR of 26.71% between 2023 and 2028, and it is forecast to increase by…

IBM Newsletters

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