Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Configuring Bitbucket Webhooks for Jenkins Multi‑Branch Pipeline to Trigger Builds on Pull Requests
Operations 5 min read

Configuring Bitbucket Webhooks for Jenkins Multi‑Branch Pipeline to Trigger Builds on Pull Requests

This guide explains how to set up Bitbucket webhooks and Jenkins Bitbucket Branch Source plugin so that every Pull Request automatically triggers a Jenkins multi‑branch pipeline build, improving build speed and reliability.

Jenkins multi‑branch pipelines can automatically build any branch or Pull Request (PR) in a Git repository, but when the Bitbucket webhook is not configured the build may not be triggered.

Problem: The author experienced two incidents where creating a PR did not start a Jenkins build, despite no changes to Jenkins or the Bitbucket Branch Source plugin.

Solution: Instead of relying on the plugin‑generated webhook, manually add a Bitbucket webhook that points to Jenkins.

Webhook name: test-multibranch Webhook URL:

http://localhost:8080/multibranch-webhook-trigger/invoke?token=test-multibranch

Test connection: returns 200 (successful)

Events: Pull Request – Opened, Merged, Declined, Deleted

Active: enabled

After configuring the webhook in Bitbucket (see screenshots), the Jenkins integration works as follows:

When a PR is opened, Jenkins creates a corresponding PR job (e.g., PR‑123) and starts the build.

When the PR is merged, the job is automatically removed.

When the PR is declined or deleted, the job is also removed.

Merged branches appear crossed out in gray and cannot be rebuilt, while develop and master branches remain buildable manually or automatically.

Event notes: The author chose not to enable the Modified event because it caused excessive builds for pending PRs, consuming build resources for several hours per run. The Modified event fires when a PR’s description, title, or target branch changes, which can be useful but was unnecessary for the current workflow.

Additional webhook events (e.g., for the main branch) can be added as needed, and a simple trigger step can be placed inside the Jenkins Pipeline if daily builds are sufficient.

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

Report an issue with this article
CI/CDJenkinsWebhookBitbucket

Reader feedback

Was this useful?

Useful0

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion