This is an old revision of the document!
Table of Contents
Bitbucket Server Pull Request Hook Plugin
TODOs
- Internationalization
- Support for HTTPs
- Test button in the config
Introduction
The plugin provides the following functionality:
- Notifying 3rd party services via REST interface about the changes in the project Pull Requests
- Notification on:
- PR creation/edit
- PR decline
- PR merge
- New/Edit/Delete comment in the PR
- Per-repository configuration via 'repository hooks' tab
- Accessible by the repository administrators
Usage
Templating
Several variables can be passed by the message URL or body. There is a special variable containing
comma separated list of available variables:
${all_keys}
[IMAGE]
Authorization
There is no dedicated field for authorization. One can add authorization header into 'headers'. In such case the field will look like:
[IMAGE]
Please visit wikipedia to learn how to construct basic auth header.
For Jenkins it is recommended to use Build Token Root Plugin. It allows using anonymous request + build token (think of API key).
Example
We want to capture the following behaviours:
- Creation of the new Pull Request
- Changes to the Pull Request
- New comment
Captured event will be propagated to Jenkins instance.
There is only a single URL per repository therefore we will need a relay job to extract necessary variables and call appropriate jobs.
1. Configure Jenkins
- Add Token
BBBUILD
- Add Parameters
2. Configure Bitbucket
- Set URL
localhost