Bitbucket Metrics with Opsera using Webhooks

Scope :

  1. Create a webhook in Bitbucket Repository

  2. Register the Bitbucket account in Opsera Portal

  3. Create Data Mappings in Opsera Portal

  4. Build Dashboard with KPIs

 

Section 1: Bitbucket

Navigate to the repository which needs to be configured.

Repository Settings → Webhooks → Add Webhook

 

Provide a name for this webook.

In URL, enter the payload URL provided by Opsera.

The Content Type needs to be application/json.

It is always recommended to keep Certificate Verification active for security reasons.

User may select the list of events that needs to be delivered to the payload URL mentioned.

Currently, at Opsera, we support the following events.

Repository: Push

Pull Request: Created, Declined, Merged

 

 

Save the webhook.

Once the Webhook is added, click on ‘View Requests’.

By default, the the History Collection will be turned off. Enable the ‘Request History Collection’.

As a part of testing, make a commit to the repository. Once its done, navigate to Repository Settings → Webhooks and click on ‘View Requests’ for the webhook created in the above step. There will be a list of payloads being delivered to the configured URL.

Section 2: Opsera Tool Registry

Login to Opsera, and navigate to Tool Registry. Tool Registry in Opsera is a central library where all customers' tools are being configured and connections ensured.

If you have performed this step while setting up pipelines, you may skip.

Click on New Tool and select Bitbucket from the list.

 

Fill in the necessary details, such as Tool Name (an identifier for the tool entry), and apply some tags. Tags can be applied at a later stage, during Data Mapping too.

Once the tool entry is created, select the entry and navigate to ‘Connections’.

Provide appropriate Bitbucket account credentials.

 

Click on ‘Test Connection’ to make sure that the connection between Opsera and Bitbucket is established successfully.

Next, user can create Data Mappings, and configure tags to associate with each individual repository.

 

Section 3: Opsera Data Mappings

Data mappings allow users to configure tags to each repository in Bitbucket. These tags will be essential when configuring pipelines and insight.

Settings → Data Mappings → New Project Tag

Select the Tool Bitbucket. All the accessible repositories will be listed in the repositories drop down. Select a Repository.

 

Provide a Project Name and apply various tags required for this repository and Save.

User can always add new tags to this entry at a later time, but Insights will start reflecting data for this new tag from the point it was applied to this entry.

Section 4: Opsera Dashboard

Insights → Dashboard → New Dashboard

Provide a name for the dashboard, and apply the tags that were created while configuring the Data Mappings. These tags can also be applied later, after adding the KPIs.

Open the created dashboard and click on ‘Add KPI’.

Page redirects to the Marketplace, which is a library of 100+ KPIs specific to each tool.

In Filter by Tool → choose Bitbucket

Marketplace displays the list of KPIs which are specific to Bitbucket.

 

Add each KPI to the dashboard in the required order.