2

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?

11
  • did you check whether there is a firewall that is blocking the web hooks?
    – 030
    Commented Aug 14, 2017 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 Commented Aug 14, 2017 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
    Commented Aug 14, 2017 at 9:37
  • Jenkins is running on EC2 amazon. Commented Aug 14, 2017 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) Commented Aug 14, 2017 at 9:46

2 Answers 2

1

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

0

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:[email protected]/user/project_name.git

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.