HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Bitbucket Pull Request Builder Jenkins job is not getting invoked

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
pullbuilderjenkinsrequestbitbucketgettinginvokednotjob

Problem

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?

Solution

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

Context

StackExchange DevOps Q#1746, answer score: 1

Revisions (0)

No revisions yet.