How to trigger Bamboo builds with GitHub webhook

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Repository Polling is added by default when configuring a GitHub repository in Bamboo. Its design is to frequently detect changes in the source code periodically or based on a schedule. However, this strategy may not be the best for all build plans since it tends to overload the server with scheduled tasks to check the remote repository, which can reduce the server performance.

The steps from this article are intended to allow you to use a different configuration that will remove the cost of frequent remote repository checks.

Environment

All supported versions of Bamboo.

Solution

Configuration steps

  1. The Bamboo instance needs to be reachable through the internet. Otherwise, GitHub will not be able to find it to trigger a build.
  2. If you already have a polling trigger configured, remove it. Go to Plan configuration >> Triggers and remove the polling trigger.
  3. Add the Remote Trigger to the plan you want GitHub to trigger.
  4. Enter the list of addresses (CIDR Notation compatible) that can trigger builds in Bamboo.
    1. The list of GitHub IP addresses for outbound POST requests by Webhooks can be retrieved from GitHub's meta API endpoint.
    2. 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 / load balancer 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 / load balancer server.
  5. Make sure the anonymous users can trigger builds. Go to Overview >> Security >> Security settings >> Check the option '[x] Allow anonymous users to trigger remote repository change detection and Bamboo Specs detection'
  6. Configure GitHub to call the following Bamboo REST API:

    https://<BAMBOO_URL>/rest/triggers/latest/remote/changeDetection?planKey=<PLAN-KEY>

    The above steps should be enough to configure the Bamboo instance for remote triggers from GitHub.

  7. Make sure that the Content-type field is set to application/json

Skip branches

The "skipBranches" can be appended to the endpoint URL to determine whether change detection will be triggered by this event for every branch on the plan (false), or just the plan key specified (true). For example:

https://<BAMBOO_URL>/rest/triggers/latest/remote/changeDetection?planKey=<PLAN-KEY>&skipBranches=false

New branches

For Bamboo 9.1 and newer versions, it's possible to automatically build pull requests from forks of projects. BAM-21710 - Getting issue details... STATUS

The steps to automatically create and run a new branch in Bamboo are the same as above, so that Github can trigger it.

For more details about remote triggers please visit the official documentation.

Visual step-by-step

Last modified on Aug 2, 2024

Was this helpful?

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