[Triggers] Bitbucket Server - How to get the Webhook working with on-prem offerings

Howdy, gang! :rocket:

This post is going to walk you through the steps required to make a Bitbucket Server Repo Event trigger a Pipeline or Workflow in Harness.
Currently, that’s not achievable with out-of-the-box features only (like with Bitbucket SaaS offering from Atlassian).

In our example, I used a Bitbucket server on version 6.2.0, to cover our 80/20–Pareto customers. But, there are newer versions here.

To make the integration work, we’ll need a Bitbucket Plugin called Post Webhooks for Bitbucket. We have some references on the docs already in this section.

So… let’s do it!

FIRST STEPS - Installing the Plugin

  1. There are a few ways to do that, but I think the easier one is to go on your Left Panel → ADD-ONS → Find new apps → Search for “Post Webhooks for Bitbucket”. That’s the one we’re looking for:

  2. After you get that, you’ll find details in the Manage apps section.

SECOND STEPS - Configuring a Harness trigger

This step is very straightforward! Just create a trigger as you would create one for Bitbucket.
The only important part here is to make sure your branch regex will match. You might have to test it a few times on the Bitbucket side, but that’s not exhaustive at all.

For testing purposes, I’m going with a “.+”, and I’ll call a simple GKS NGINX Workflow:

Submit that, and save your Bitbucket Webhook for later steps.

THIRD STEPS - Configuring a Bitbucket Repo - and the Webhook

As this is a test env, I’ve created a very simple Project Repo:

If you go on your Repository Setting (that gear icon), you are going to see the extra Plugin option there. It’s called Post Webhooks, and it’s under the WORKFLOW section (left-side panel):

Just add the webhook there! Follow my example, and fit the triggering Events to your use case:

LAST STEPS - Let’s test that!!!

I’ll do a silly update to the trigger.txt file:

And voilà!

I hope you could understand and reproduce my steps. Feel free to ask us anything, here in this thread, so we can help ASAP!