HOW TO ADD WEBHOOK IN GITLAB?

WHAT IS WEBHOOK?

There are many cases where an event happening in one system need to be informed to another system to trigger some related events/actions in the second system. Webhook is a web callback or HTTP push API, which will provide information and data about an event to other applications.

For example: Whenever new code gets committed (event) to a code repository (first system), you may want to setup a Webhookin the repository to run and alert the build and deployment tool (second system) to redeploy the application.

Webhooks help in application integrations. Apps can subscribe to certain events in other systems and will get informed when such events happen in the subscribed system. In the above example, Build and Deployment Tool has subscribed for code commit events in the Code Repository System using Webhook.

ADDING A GITLAB WEBHOOK

Step 1: Login and select a Repository

Login to Gitlab and navigate to your code repository.WordPress repository is selected as an example below.

Step 2: Open Settings

Click on the settings tab to expand it to view the Webhooksub menu

Step 3: Open Webhooks screen

From the left side menu (shown above), click and selectWebhook.This will open the Webhook edit screen on the right.

Step 4: Edit/Add Webhook information

Add the following information in the Add Webhook screen

  • URL: Webhook URL here>
  • Secret Token: Webhook here>
  • Trigger:
  • Click Add Webhookbutton.

This will enable Gitlab to send a POST request to the URL specified based on alerts set.

Now you have successfully completed setting up a Webhook for your Gitlab repository.

Interested in reading similar articles?  Please follow us on LinkedIn.

About The Author

Dr. Anil Kumar

VP Engineering, CLOUD CONTROL
Founder | Vice President | CTO | Architect | Consultant | Mentor | Advisor | Faculty

Solution Architect and IT Consultant with more than 25 years of IT Experience. Served various roles with both national and international institutions. Expertise in working with both legacy and advanced technology stacks and business domains.

About Cloud Control

Cloud Control simplifies cloud management with AppZ, DataZ, and ManageZ, optimizing operations, enhancing security, and accelerating time-to-market. We help businesses achieve cloud goals efficiently and reliably.

2024
GITEX
14-18 October

Dubai, UAE