Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xmatters/xm-labs-bitbucket-pipeline
Webhook integration for failed builds from bitbucket
https://github.com/xmatters/xm-labs-bitbucket-pipeline
bitbucket-pipelines build-tool xmatters
Last synced: 10 days ago
JSON representation
Webhook integration for failed builds from bitbucket
- Host: GitHub
- URL: https://github.com/xmatters/xm-labs-bitbucket-pipeline
- Owner: xmatters
- License: mit
- Created: 2017-07-28T15:56:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-10T18:40:47.000Z (over 4 years ago)
- Last Synced: 2024-11-06T08:30:54.795Z (about 2 months ago)
- Topics: bitbucket-pipelines, build-tool, xmatters
- Size: 60.7 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bitbucket Pipelines
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:
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/drhk8P-0RYY/0.jpg)](https://youtu.be/drhk8P-0RYY)
# Pre-Requisites
* Bitbucket account - [Get one](https://bitbucket.org/)!
* xMatters account - If you don't have one, [get one](https://www.xmatters.com)!# Files
* [BitbucketPipeline.zip](BitbucketPipeline.zip) - The Workflow with integration builder scripts and message templates.# How it works
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.# Installation
## xMatters set up
1. Login to the xMatters account and navigate to the Developer tab.
2. Import the [BitbucketPipeline.zip](BitbucketPipeline.zip) Workflow.
3. Click Edit > Integration Builder next to the Bitbucket Pipeline Workflow.
4. 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.
5. 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](https://help.xmatters.com/OnDemand/xmodwelcome/communicationplanbuilder/subscriptionforms.htm?cshid=SubscriptionFormListPlace) for details.## Bitbucket Pipeline set up
1. Login to Bitbucket and navigate to the desired repo.
2. Click Settings > Webhooks:
3. 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.
4. Click Save.
5. Repeat for each repo.# Testing
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:```json
/// 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).
# Troubleshooting
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.