Triggering a Bamboo build from Bitbucket Cloud using Webhooks

Webhooks provide a way to configure Bitbucket Cloud to make requests to your server (or another external service) whenever certain events occur in Bitbucket Cloud. The purpose of this guide is to help you set up a Webhook that will trigger a Bamboo build from Bitbucket Cloud after a certain event. For example, you may want Bitbucket Cloud to trigger a Bamboo build when your repository receives a commit (aka post-commit trigger).

方法

  1. First configure the Bamboo plan to trigger with a Remote triggerActions > Configure plan > Triggers > Add trigger > Remote trigger.
  2. Bamboo requires you to add to the allowlist the IP addresses of the source of the request to trigger under the Trigger IP Addresses field (comma separated for each IP). 
    1. The current list of Bitbucket Cloud IP addresses for outbound POST requests by Webhooks: Bitbucket Cloud IP Addresses
    2. CIDR Notation is only supported in Bamboo 5.14+
    3. Bamboo's IP allowlist also inspects the X-Forwarded-For HTTP header to determine the origin of the request. If you have a reverse proxy forwarding requests to your Bamboo instance, depending on its configuration, you may also need to add to the allowlist the IP address of the Proxy Server.
  3. Add a Webhook to your Bitbucket Cloud repository: Bitbucket Cloud > Repository > Settings > Webhooks > Add webhook.
    1. Title: Select any title for your Webhook that aptly describes it.
    2. URL: Enter the URL of the Bamboo API to trigger a plan: BAMBOO_URL/rest/triggers/1.0/remote/changeDetection?planKey=PLAN-KEY&skipBranches=false
      1. Replace BAMBOO_URL with the URL of your Bamboo instance.
      2. Replace PLAN-KEY with the key of the plan you wish to trigger. The PLAN-KEY is visible in the URL when browsing the plan in Bamboo. E.g. https://bamboo.atlassian.com/browse/PLAN-KEY
      3. skipBranches true / false will determine whether change detection will be triggered by this event for every branch on the plan (false), or just the plan key specified (true).
    3. Triggers: Select the event(s) you want the Webhook to activate on. E.g. Repository Push.
    4. Save.

That's it! If you find 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.

最終更新日 2021 年 5 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.