Bitbucket Post Webhook

Last updated: Aug 24, 2020

Basic information

Bitbucket Post Webhooks makes it possible to post JSON data to an HTTP/HTTPS address. The data is sent when a configured event occurs and all filters are passed.

Jenkins 2.0 plugin is supported.

More information how to setup Jenkins.

Main features

  • You can send JSON payload from Bitbucket Server or Data Center to an external system like Jenkins, customer scripts, Serverless functions, etc

  • You can configure the rules on a global, project and repository level. Corresponding permissions are respected.

  • You can filter events by:

    • Event (including Repository Mirror Synchronised, Build Status Update and other events)

    • Committers

    • Branch masks

    • Project

  • You can use API to create rules. The same APIs are use by Bitbucket Branch Source Jenkins plugin.

  • If something is missing please reach out.

Repository configuration

Important: repository configuration by default overrides project and global configuration (this is configurable in the latest versions).

In order to setup webhook posts you need to select the events and filters about which you want to notify your system about. It can be Jenkins branch source plugin or any other system.

The configuration is available at Repository → Settings → Post Webhooks.

When you start with an empty list you need to add a new configuration.

You need to click “Add webhook“. Here is picture how it looks (July 2020).

Here you need to setup:

  • the title - what is the name of the configuration (can be something random, or meaningful with your repo or person name). Our advice is to name something meaningful to you and your team so that it can be understood later easier.

  • Override project and global settings. On by default. You can use this setting to override project and global setup. If it is off, the project and global level configuration will take precedence.

  • the URL - where the data should be sent to. F.e.

    • You can skip SSL verification and test connection with additional auxiliary settings.

    • {project.key} variable can be used as part of the url to be replaced by Bitbucket project’s key.

    • {repository.slug} variable can be used as part of the url to be replaced by Bitbucket repository’s slug.

  • Committers to ignore (full match) - the comma-separated list of Bitbucket user names that should not trigger an event. Important: not display names, but usernames. This often used to ignore pushes from you continuous integration user. For instance, you could put there jenkins-user.

  • Branches to ignore (regex) - the comma-separated list of Bitbucket branch regexes that should be ignored. For instance, release/*, tag/*, etc.

  • Active - should be On if this configuration to be used.

  • Select the list of the events that you want to notify your external system about.

  • Skip CI - a setting which allows to skip notification for the pull requests if [ci skip] or [skip ci] is present in the pull request’s title or description.

For instance, you don’t want to notify Jenkins about the changes made by Jenkins user to not trigger cyclomatic build dependency, so you will add the Jenkins user to the committers to ignore.

Project configuration

Important: project level configuration by default overrides global configuration.

The configuration screen is available for project and global admins at Project settings → Workflow → Post Webhooks.

At the project level you can also see all repository rules.

The setup process is the same as for the repository rules (please see above). Do remember that you can use string substitutes for project’s key and repository’s slug.

Global configuration

The global configuration screen for global admins at Administration → Add-ons → Post Webhooks.

At the global level you can also see all repository and project level rules.

The setup process is the same as for the repository rules (please see above). Do remember that you can use string substitutes for project’s key and repository’s slug.

Enable multiple rules on the repository level

This setting is located in the Global settings → Multiple configuration checkbox.

 

API

Please navigate to the API documentation - Atlassian Bitbucket Post Webhook API.

Outgoing API contracts are here - https://moveworkforward.atlassian.net/wiki/spaces/DOCS/pages/1132265480/Post+Webhooks+for+Bitbucket+outgoing+API

Providing feedback

Please contact us via the Service Desk.

Debugging

You need to enable debug mode and look for logs from nl.topicus.bitbucket