Slack Integration in GitLab | CI/CD with GitLab Part 3

Hello, today I am going to talk about Slack integration in GitLab. Nowadays, Slack is the widely used team collaboration software tools among IT companies. So integration Gitlab CI/CD with Slack enables the development team to get early feedback on what’s going on with their builds, test, and deployment.

GitLab has out of the box integration for most of the widely used tools in the development ecosystem. All of these tools provide some webhooks for GitLab to consume. By this way, GitLab will provide real-time data to paired tools.

What you need for this tutorial is

  • Slack account
  • Gitlab account

Configure Slack 

You need to browse  and create a Slack app.

Slack integration in GitLab

Then you should give a name to your app like GitLab (it can be anything), and choose your workspace. For ours, we choose swtestacademy.

Slack integration in GitLab

Now your app is created on Slack, the only thing you should do is to activate Incoming Webhook options on Incoming Webhook menu.

Slack integration in GitLab

When you turn on the Incoming Webhooks, it will ask you to choose the channel where notification from GitLab are going to be sent. I choose #general channel.

Slack integration in GitLab

After the configuration, you need to click “Add New Webhook to Workspace” to create your webhook URL.

Slack integration in GitLab

Here’s the webhook, you should copy that value to use it in GitLab configuration.

Slack integration in GitLab

Configure Gitlab

You need to login to your GitLab account and enable the Slack Integration for specific repository. So you go to Settings->Integrations->Slack notifications.

Slack integration in GitLab

On that screen, you have to check Activate checkbox. Then you should enter the channel name for the events that you want to receive. For me, it was

  • Push -> General
  • Pipeline -> General

Then finally, you have to enter webhook url and your credentials and save it.

Slack integration in GitLab Slack integration in GitLab

Now let’s push something to our branch and trigger our pipeline. You can use the example that we gave earlier on this article.

I pushed a change to my Gitlab repository. Here’s the slack message

Slack integration in GitLab

My pipeline is trigger after the push request. You can see the “Commit message” on the pipeline.

Slack integration in GitLab

Finally, after the pipeline finishes its execution, we get the final result on Slack channel.

Slack integration in GitLab

Now, it’s your turn to adapt your CI/CD pipeline with Slack or any other tool.

Leave a Comment

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