Build, test and deploy, and with this integration, alert, from Bitbucket. This integration adds xMatters messaging to the build failed notifications from the pipeline.
Check out the video:
- BitbucketPipeline.zip - The Workflow with integration builder scripts and message templates.
After the build status changes, a webhook is fired to the xMatters integration builder. The script in the IB inspects the build type and status and if it is a failed build, a new event is created targeting the default recipients in the form.
- Login to the xMatters account and navigate to the Developer tab.
- Import the BitbucketPipeline.zip Workflow.
- Click Edit > Integration Builder next to the Bitbucket Pipeline Workflow.
- Open up the Build Failed Flow and click on the
Inbound from Bitbucket Pipeline
step. Copy the URL in the step and save for later. - Click the Form tab and Edit > Layout. Enter the targeted recipients in the recipients box. Alternatively, subscription panels can be added to let users subscribe to notifications. See here for details.
- Login to Bitbucket and navigate to the desired repo.
- Click Settings > Webhooks:
- Click Add Webhook and enter a title and paste in the url from the step. Check
Build status updated
. Other boxes can be checked, but keep in mind this integration was built with the intent of notifying on failed builds, so the integration script will need to be updated to reflect other options.
- Click Save.
- Repeat for each repo.
Commit a change to the repo that will fail the build. For example, for a node.js application, having this entry in package.json
will fail the test:
/// snip ///
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon -e css,ejs,js,json --watch ."
},
/// snip ///
Once the build fails, a notification will be sent to the recipients saved in the form layout (unless subscriptions were set up).
In the repo Settings > Webhooks section, each webhook has a View Requests
button. This shows the details of the HTTP request from pipelines out to xMatters. Review this list for any errors:
Then if evrything looks ok there, check the Activity Stream in the Inbound from Bitbucket Pipeline
inbound integration for any errors.