Triggering a Bamboo build from Bitbucket Cloud using Webhooks

Webhooks provide a way to allow Bitbucket Cloud to make requests to your server whenever certain events occur in Bitbucket Cloud. The purpose of this guide is to help you setup a webhook that will trigger a Bamboo build from Bitbucket Cloud after certain events like creating a branch or pull request, or pushing a commit.

  1. When creating or editing a repository, turn on the Enable webhooks flag in the main configuration section.
  2. Register and configure a webhook either from Bamboo or Bitbucket Cloud in one of the following ways:
    • From Bamboo, use the Register webhook button just below the Enable webhooks flag on the repository configuration page. In the dialog configuration screen, use the appropriate option for credentials that have access to the Bitbucket Cloud repository webhooks. Also, provide the URL from which Bamboo is accessible by Bitbucket Cloud. Bamboo takes care of registering all required trigger types.
    • From Bitbucket Cloud, add a webhook from the repository by selecting Bitbucket Cloud > Repository > Settings > Webhooks > Add webhook, and then configure the webhook:
      1. Specify any title for your Webhook that aptly describes it.
      2. Enter the URL of the Bamboo API to trigger a plan as follows:
        <BAMBOO_URL>/rest/bitbucket-cloud/latest/webhooks
      3. To achieve all the integration capabilities, select all the required trigger types:
        • From the list of repository triggers, select Push.
        • From the list of pull request triggers, select:
          • Created
          • Updated
          • Merged
          • Declined
      4. Save your changes.
  3. Configure your Bamboo plan to trigger a build using the Bitbucket Cloud repository trigger by selecting Actions > Configure plan > Triggers > Add trigger > Bitbucket Cloud repository trigger.

    If the plan was created after creating the repository, this is the default trigger for the plan.

That's it! If your webhook doesn't appear to be working, the best place to start troubleshooting is by viewing the request and response at Bitbucket Cloud > Repository > Settings > Webhooks > View requests.

Last modified on Aug 24, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.