We use Jenkins and have the Bitbucket plugin installed. We've got multiple repos and use webhooks for lots of jobs coming from our foo repo. No problems there, the jobs go off without a hitch. Now however we want to start running a couple jobs via webhook from our bar repo.

The Problem

The default behavior here is that as soon as we attach a webhook to bar, commits to either repo will trigger any job with polling. I know we can hardcode in logic in each job to either only build when commits match a certain pattern, or ignore any commits matching a pattern.

Given the number of jobs we have that currently use polling this would be insanely unideal to have to code in to make it backwards compatible, not to mention potentially doing this again if we start running unit tests on even more repos in the future.

The Ideal Solution

I'm hoping I might be missing some way to differentiate between commits made from foo vs bar on the Bitbucket side, rather than needing to change anything in each Jenkins job. Ideally, there's some way to change the webhook so each repo gets its own url. Does this, or some other blanket solution, exist? (I will accept "no" as an answer if that's the case).

4 Answers 4


I believe it is now possible to configure the webhook on per-repo basis:



You could:

  • prune your branches. (guessing you'd have done this by now if feasible.)
  • implement Jenkinsfile, a code-driven pipeline, and simply remove the jenkinsfile from the branches you don't want built or triggered by SCM-polling.

One could use SCM polling and specify different branches that need to be polled.

  • As I stated in my question, while this is a valid approach on a smaller scale, this is impractical for my case, where black/whitelisting branches would be a monumental task.
    – Alex
    Commented Oct 23, 2017 at 13:12

So... I had this issue and solved it by making sure I passed the pull request ID to the Jenkins job and the Branch ID from Pull Request. I've attached a screen shot. enter image description here

And this as well:

enter image description here

you can absolutely control what Jenkins pulls from your SCM w/the proper configurations - these should get you there.

Also: I have polling disabled - you really don't want to use polling as it is expensive - configure a BitBucket PullRequest plugin to call your Jenkins job upon creation as you are doing and you shouldn't need to poll, although I don't know that particular plugin... this one is great:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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