Bitbucket Server has the ability to send a JSON payload to a webservice endpoint upon a developer commit push. This part of the tutorial describes how to set this up to send this payload to Continuum.
This article assumes that you have started the Initial Setup tutorial and have already created your first Continuum project. It also assumes that if you are using Bitbucket Server, that you will either use Git locally or the "Power Editor for Bitbucket" by Mohamicorp plugin to make source code changes directly in the web browser.
Setup a Continuum Project
On the Source tab of the project you created in Continuum, make sure the
Changes From dropdown is set to “Stash Webhook”.
NOTE: Changes are automatically saved on most Continuum pages.
Next copy the resulting Webhook Endpoint to a text editor by clicking on the blue button then pasting.
Now you will need to replace the <api-token> part of that URL with an API token. For purposes of this example, you can use your account by going to My Account, then copying the token and pasting that into the URL.
In this example, the full Webhook Endpoint URL will look as follows:
This webhook URL will be needed in a later step so keep it handy.
Setup Bitbucket Server Webhook
Now login to your Bitbucket administration user interface. By default this runs on port 7990 of your Bitbucket server. Go to the
Settings page of the repository you will use for the tutorial.
Now click the
Add Hook button.
Search for “Bitbucket Server Web Post Hooks Plugin” and click the “Install” button. Follow the rest of the prompts and then return the the project settings, hooks page. Refresh the page if need be.
Enable the “Bitbucket Server Web Post Hooks Plugin”.
On the popup you will need to paste in the URL from the Continuum project in the first section of this page. Make sure it includes the API token. Click Enable.
For more information on the Post-Receive WebHooks for Bitbucket Server, see the Atlassian documentation:
Test the Webhook Push
Now submit a change to your Bitbucket Server repository. This simply can be a change to a file, commit and push.
Now in Continuum on the Submissions tab of your project, check to see that the webhook worked as expected.
Click on the submission row and explore the information submitted from Bitbucket Server including the Changes (commits), raw json payload and the logfile of the process that Continuum used to process the submission.
When Bitbucket pushed the change to the Continuum REST API, the Json payload was converted into a normalized Change record in Continuum. This change can now be tracked throughout its lifecycle.
If you do not see that a change made it onto the project in Continuum, here are some steps to troubleshoot.
First start with looking at the logs on the Bitbucket Server server. A log file may contain an error message if the POST was unable to reach the destination or if there was some sort of error returned from the Continuum REST API. A pattern to search for would be “submitchange”.
Other common problems to look for:
- Wrong Continuum server address and port
- Network access from Bitbucket Server server to Continuum server
- Local firewall on Continuum server needs to allow port 8080
- Wrong Continuum API token
- Wrong project name in webhook URL
- Project not fully configured in Continuum
- Post-Receive Webhooks not enabled for repository
- Commit was not pushed to Bitbucket Server
If you continue to have problems with getting the changes posted from Bitbucket Server to Continuum, contact firstname.lastname@example.org.