Bitbucket webhook is not triggering the build in jenkins

Muddassir Farooq February 15, 2018

I am using Jenkins and bitbucket integrations. I want to trigger a build when a PR is created. I created a webhook on bitbucket its returning 200 response but no build is getting triggered. I have enabled "Build when a change is pushed to BitBucket" option in the build configuration.

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Hakeem Olasupo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 20, 2021

You have to ensure that your Webhook (Settings->Webhooks) is pointing to your Jenkins bitbucket-hook like the following: "https://ci.yourorg.com/bitbucket-hook/". Notice that last "/", without it, the build will not be triggered.

 

After some struggling with the BitBucket plugin, I have managed to get it working. Below is the summary of things I found are necessary for builds to be triggered, but are not obvious from plugin's documentation:

 

Make sure your webhook has repository push trigger enabled. I thought pull request created / updated would suffice (building on PR is what I wanted) but the plugin reacts only to push.

Set your repository URL (in Git plugin) to https://bitbucket.org/REPOSITORY_OWNER/REPOSITORY_NAME. Plugin will not match it if it's the SSH url.

You do need the SCM polling enabled. The plugin itself does not pull the changes. You can leave the schedule field empty, so repository is polled only when the plugin triggers it.

I hope this helps. If the build is still not triggered for you, try enabling logs for the following classes:

 

com.cloudbees.jenkins.plugins.BitbucketHookReceiver

com.cloudbees.jenkins.plugins.BitBucketTrigger

com.cloudbees.jenkins.plugins.BitbucketJobProbe

com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor

com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource

TAGS
AUG Leaders

Atlassian Community Events