View Bitbucket Push and Pull Request on the plugin site for more information.
This plugin requires a Jenkins v2.138.2 or later and supports the Bitbucket rest api v2.x+ and later.
The new features introduced by the Bitbucket Push and Pull Request plugin are:
- support of pull requests
- usage of Gson instead of net.sf.json.JSONObject (blacklisted starting from Jenkins 2.102+)
- Introduction of models and security improvements
In which cases should I use this Plugin?
If you are using a Jenkins v2.138.2 or later, you may have some problems with the older Bitbucket plugin. This uses the JSONObject, already blacklisted by the JEP-200, causing an exception UnsupportedOperationException: Refusing to marshal net.sf.json.JSONObject for security reasons
Configure the webhook
In case you are using Bitbucket Cloud, configure your Bitbucket repository adding a webhook in the settings page. In the URL field (see image, point A) add your JENKINS_URL followed by "/bitbucket-hook/" (for example "https://my-jenkins.on-my-planet-far-away.com/bitbucket-hook/") Credentials for the webhook endpoint are not required, the trailing slash is mandatory. For more infos please consult the resource https://confluence.atlassian.com/bitbucket/manage-webhooks-735643732.html.
If you are using Bitbucket Server, follow the following steps:
- First install on the Bitbucket Server the Post Webhooks for Bitbucket plugin (it's free).
- After that, create from the repository settings a post-webHook and configure it as described for the Bitbucket Cloud.
Configure your Jenkins job
1. Configure the Bitbucket Repository under the Source Code Management with your credentials.
2. Now activate the plugin in your job selecting the "Build with Bitbucket Push and Pull Request Plugin" option in the Build Triggers pane.