Bitbucket Pipelines Triggers
The built-in Bitbucket Pipelines Triggers initiates a flow when it receives a signal from a Bitbucket webhook.
- Go to the Triggers panel in the palette, expand the App Triggers section and drag the trigger onto the canvas.
- Double-click the trigger (or click the pencil icon).
- Set the authenticating user, and then copy the URL — you'll use this to set up the webhook in Bitbucket. Alternatively, you can create an integration user to use as the authenticating user.
- Click the Flood Control tab to edit the trigger's default flood control settings. For more information about these settings, see Trigger Flood Control.
- Click Done.
- On the flow canvas, connect the steps you want to run when xMatters receives a request to that URL.
You're now ready to configure Bitbucket to target the trigger.
Configure Bitbucket to send requests to the trigger URL
To have Bitbucket send alerts to the flow trigger, you need to configure a webhook and set it to use the trigger URL.
- In Bitbucket, select your repository.
- From the menu, select Repository settings.
- From the Workflow menu, select Webhooks.
- Click Add webhook to create a new webhook.
- On the Add new webhook page, give the webhook a Title.
- In the URL field, add the trigger URL you copied from Flow Designer.
- Add the target names of any recipients you want to notify when the monitor creates an alert.
- For URL authentication, use an ampersand to attach recipients. For example, if you want to notify Emma Pearson and the on-call members in the group responsible for the Antares service, you'd add &recipients=epearson,antares to the end of the URL.
- For other authentication types, use a question mark to attach recipients. For example, if you want to notify Barry Gull and the on-call members in the group responsible for the Cassiopeia service, you'd add ?recipients=bgull,cassiopeia to the end of the URL.
- You must URL-encode any special characters or spaces in the target names.
- In the Status section, select Active.
- From the Triggers section, go to the Repository column select Build status created and Build status updated.
- Click Save.
The new webhook is saved and listed under the Repository hooks section of the page.
You're ready to use the webhook to trigger automated flows, including steps such as sending alerts and initiating incidents, though we always recommend testing before putting things into use.
The trigger has the following outputs you can use as inputs to steps further along the flow.
|List of targeted recipients.|
|Actor Display Name||Name of the user that made the commit.|
|Actor Link||Direct link to the user’s Bitbucket account.|
|Actor Type||Account type of Bitbucket user that made the commit.|
|Commit Date and Time||Timestamp of when the commit or update occurred in Bitbucket, in ISO format.|
|Commit Hash||Hash of the commit associated with the pipeline build event.|
|Commit Link||Direct link to the commit in Bitbucket.|
|Commit Message||Description for the commit, as provided by the Bitbucket user.|
|Project Link||Direct link to the Bitbucket project.|
|Project Name||Name of the Bitbucket project that contains the pipeline build event.|
|Repository Link||Direct link to the Bitbucket repository.|
|Repository Name||Name of the Bitbucket repository.|
|Pipeline Name||Name of the Bitbucket pipeline.|
|Pipeline Reference Name||Reference name or branch of the pipeline where the build event was triggered.|
State of the pipeline build event. Available values are:
|Pipeline URL||Direct link to the pipeline build event.|
|Raw Request||JSON representation of the request. You can parse the raw request if you need additional details beyond the standard outputs.|