I have enabled web hooks pull request in Bitbucket like below -

enter image description here

And my Jenkins job configurations are as follows -

enter image description here

Bitbucket hooks are getting invoked as soon as I create pull request but Jenkins job is not getting invoked. Can anyone help please?

  • did you check whether there is a firewall that is blocking the web hooks? – 030 Aug 14 '17 at 9:29
  • My push jobs are working fine. only pull jenkins jobs are not getting invoked. If there would be firewall issue then push also didn't work – Pramod Kumar Aug 14 '17 at 9:33
  • Where does the Jenkins run? If jenkins runs on premise and bitbucket in the cloud it could be possible that bitbucket is not able to trigger jenkins if there is a office firewall in between. – 030 Aug 14 '17 at 9:37
  • Jenkins is running on EC2 amazon. – Pramod Kumar Aug 14 '17 at 9:41
  • I am seeing this error in jenkins cosole - ←[33mAug 14, 2017 9:44:02 AM bitbucketpullrequestbuilder.bitbucketpullrequestbui lder.bitbucket.ApiClient getAllValues WARNING: invalid response. java.io.EOFException: No content to map to Object due to end of input at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.ja va:2775) – Pramod Kumar Aug 14 '17 at 9:46

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: https://bitbucket.org/RepositoryOwner/RepositoryName

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:

https://user:password@bitbucket.org/user/project_name.git

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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