Triggering a Bamboo build from GitHub using Webhooks
Webhooks provide a way to allow GitHub to make requests to your server whenever certain events occur in GitHub. The purpose of this guide is to help you setup a webhook that will trigger a Bamboo build from GitHub after certain events like creating a branch or pull request, or pushing a commit.
- When creating or editing a repository, turn on the Enable webhooks flag in the main configuration section.
- 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 GitHub repository webhooks. For more details , see Configure a GitHub source code repository section at Linking to GitHub repository. Also, provide the URL from which Bamboo is accessible by GitHub. Bamboo takes care of registering all required trigger types.
- From GitHub, add a webhook from the repository by selecting GitHub > Repository > Settings > Webhooks > Add webhook, and then configure the webhook:
Set Content type to
application/json
Enter the URL of the Bamboo webhook entrypoint as a Payload URL as follows:
<BAMBOO_URL>/rest/git/latest/gh/webhook/invoke
- To achieve all the integration capabilities, select all the required trigger types:
From Which events would you like to trigger this webhook section, select Let me select individual events.
- From the list, select:
Branch or tag creation
Branch or tag deletion
Pull requests
Pushes
Make sure you select the Active checkbox.
- Save your changes.
Configure your Bamboo plan to trigger a build using the Bitbucket Cloud repository trigger by selecting Actions > Configure plan > Triggers > Add trigger > GitHub 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 GitHub > Repository > Settings > Webhooks > Bamboo webhook > Recent Deliveries.