I need to integrate BitBucket with Jenkins, so that whenever a PR is opened in BitBucket, it will trigger a build in Jenkins. Can someone help describe the exact configuration step that I should follow in BitBucket and Jenkins to achieve this?

This is my configuration so far:

enter image description here


You can install 'Bitbucket Server Webhook to Jenkins' in Bitbucket. https://marketplace.atlassian.com/plugins/com.nerdwin15.stash-stash-webhook-jenkins/server/overview

Once install you will need to enable the 'Post Receive' Hook on the required repository.

Remember to enable 'poll SCM' for the Jenkins Job.

Update You can test the configuration of the plugin here: enter image description here

  • Thanks for infor Kyle... I tried the way you suggested but still its not working.. (I am using jenkins version 2.34) . – kumar Mar 30 '17 at 16:16
  • Installed Post Receive Web hook on particular repo.. Entered the URL (p-gp2-apjsjenkins-1.imovetv.com/bitbucket-hook) & Enabled it (I am using jenkins version 2.34) . – kumar Mar 30 '17 at 16:27
  • 1
    Hi Kumar, Can you provide me with more information on the error you are receiving or the console output you are receiving? – Kyle Steenkamp Mar 30 '17 at 17:05
  • 1
    Hi Kyle.... The build triggering successfully when there is open pull request.. at the same time its also triggering for scm changes to that repo... – kumar Apr 3 '17 at 17:59

This is how I've setup my BitBucket Pull Requests Builder.

Pull Request Builder Example


Use * * * * * and it will poll BitBucket every minute to check for PRs.


Setup a shared credential that you can use amongst all projects.

Repo Owner & Name

You should take the data from your repo URL/SSH like:


Branches Filter

You can choose to only build specific branches or leave it blank to build all.

CI Identifier & Name

I set this as the name of our CI account we setup on BitBucket. If you create a new BitBucket account just for your pull requests, grant permission to the repositories that it needs. Then whatever username you set that new account to have enter it as the CI Name and CI Identifier.

Finally, leave the bottom two options ticked.

That's the settings that work for us.

  • 1
    The way you suggest working fine.. But the build also triggered whenever there is changes happened to bitbucket... – kumar Apr 3 '17 at 17:00

We were able to achieve this using Jenkins multibranch pipeline, upon pull request creation and update pipeline would create a new job. It'll check out the pull request so we can build / run unit tests / sonarqube analysis on it.

Refer following for step by step guide, https://www.whatsuptec.com/trigger-jenkins-pipeline-on-bitbucket-pull-request/

  • Please add the steps that are required to prevent that these will be lost if the URL gets deprecated. – 030 May 15 '20 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.