Skip to main content

Adding a Bitbucket webhook

Abstract

You can specify webhooks on Bitbucket so that Bitrise automatically triggers a build of your app whenever you perform a specified action, such as a code push or a pull request.

To have Bitrise automatically start a build every time you push code into your repository, you can set up a webhook at your code hosting service which will automatically trigger a build on Bitrise with the code you push to your repository.

In addition, you can take advantage of Git Insights if you set up the webhook with the necessary permissions. Git Insights enables you to quantify and optimize Git collaboration. It provides crucial metrics like pull request cycle time and merge frequency.

You can register a webhook either automatically or manually. This guide walks you through the process of manually registering a Bitbucket webhook.

  1. Open your app on Bitrise with a user that has the Admin role on the app.

  2. On the main page of the app, click on the App Settings icon: settings.svg.

    app-settings.png
  3. On the left, select Integrations.

  4. Click Set up webhooks manually.

  5. In the pop-up window, select Bitbucket Webhooks from the dropdown menu.

    apps-webhooks-select.png
  6. Copy the webhook URL.

  7. Navigate to your Bitbucket repository and select Settings.

    Adding a Bitbucket webhook
  8. Select Webhooks from the left.

    Adding a Bitbucket webhook
  9. Select Add Webhook.

    Adding a Bitbucket webhook
  10. Paste the Bitbucket Webhook URL from Bitrise to the URL and add a Title.

    Adding a Bitbucket webhook
  11. Select Choose from a full list of triggers.

    Adding a Bitbucket webhook
  12. Select the necessary permissions:

    • For automatically triggering builds, you just need to select Push from the Repository permissions, and Created, Updated and Comment created and Comment updated from the Pull Request permissions.

    • For Git Insights, you need everything you need, in addition to the above, Merged and Declined from the Pull Request permissions.

      bitbucket-webhook-settings.png