I have enabled web hooks pull request in Bitbucket like below -
And my Jenkins job configurations are as follows -
Bitbucket hooks are getting invoked as soon as I create pull request but Jenkins job is not getting invoked. Can anyone help please?
It took me a while to understand this as well as I had experience with Bitbucket Server and not Bitbucket Cloud which is different.
You do not need to enable the webhook for the Bitbucket Pull Request Builder plugin in Jenkins.
Just ensure you set the RepositoryName and RepositoryOwner properly from the URL of your repo as such:
Once you have that set, a new PR or commit to branch of existing PR will trigger your job.
P.S. There's a bug in the plugin where you can't use git for other repos such as workflow library or pipeline from scm. Git will try to use the same hash to checkout all repos which will fail the build.
P.P.S. The webhook in Bitbucket cloud uses a POST with Json data so that can't be used with the git plugin in Jenkins unless you don't care about the hash or branch.
EDIT: One last note, I've since moved to use the multibranch pipeline with bitbucket branch plugin and that works great with the webhook as well as allows us to use a workflowlib library
I have experienced issues with other plugins as well. I was enabling the build status notification plugin and the build status was not reported. I was checking the log and it turned out that the repository should have been cloned. I would suggest to inspect the Jenkins log when a Pull Request is created in Bitbucket.
if that is the error you're getting, it is clearly an issue with BitBucket Authentication as that is in the stack trace... the specific API call which is failing is displayed and you can see it is in the authentication process... as to why it is running successfully when invoked manually - it would have to do with a configuration upstream somewhere - check the format of your repo and make sure you use this pattern: