How to Trigger Non-Multibranch Jobs from Bitbucket Server?


  • I want to configure Jenkins and Bitbucket Server to automatically trigger non-multibranch jobs on changes



The Git Plugin provides support in Jenkins to process webhooks received from Bitbucket Server via the add-on Webhook to Jenkins for Bitbucket. This add-on performs a request to the endpoint /git/notifyCommit that is the push notification feature of the Git Plugin.

Note: The Bitbucket Plugin provides support in Jenkins to process webhooks received from Bitbucket Server via the add-on Bitbucket Server Web Post Hooks Plugin. However the functionality is currently broken. This is tracked by JENKINS-28877.

Configuration in Jenkins

Freestyle Jobs

1) Configure the Git SCM:

2) Configure the project with “SCM Polling” and ensure “Ignore post-commit hooks” is disabled:

Pipeline Jobs

1) Configure the Pipeline script from SCM:

Or a Pipeline script:

node {
    checkout([$class: 'GitSCM',
        branches: [[name: '*/develop']],
        doGenerateSubmoduleConfigurations: false,
        extensions: [],
        submoduleCfg: [],
        userRemoteConfigs: [[
            credentialsId: 'support-team-bitbucket-up',
            url: ''

2) Configure the project to “SCM Polling” and ensure “Ignore post-commit hooks” is disabled:

IMPORTANT: Build the project once to retrieve the Git data.

Note: It is possible to checkout multiple repositories in Pipeline. Be aware that when the Git plugin receives a notification that a certain repository has changes, any Jenkins pipeline that checkouts this repository using the git or the checkout step may be triggered if this step does not have poll: false specified

Configuration in Bitbucket Server side

Go to the Settings of a repository. Then go to the section Hooks and click on Bitbucket Server Webhook to Jenkins:

Specify the Jenkins URL. Also ensure that the Repo Clone URL matches the Repository URL in your Jenkins job:

Click on Enable and ensure that the webhook and enabled:

From now on, Push events to the repository notifies the Bitbucket plugin and triggers a new build.

(Note: Since version 4.1.1 of the Webhook To Jenkins for Bitbucket, it is now possible to set up a webhook at a Bitbucket Project level. It is also possible to notify multiple Jenkins instance. See the Documentation of the Webhook To Jenkins for Bitbucket for more details.)


1) You need to ensure that the Repo Clone URL configured is exactly the same as in the Jenkins job, if not the trigger will not work correctly.

2) You need to ensure that your workspace is not deleted after every build. The Git plugin needs the workspace in order to compare previous commits to check if there were changes in the repository or not.

Pull Requests

(We strongly encourage to use Pipeline Multibranch for such scenario)

There is currently no simple solution to trigger jobs on Pull Requests for Bitbucket Cloud. There is some work in progress in the Bitbucket Plugin to make this possible. This is tracked by JENKINS-23685.

In the meantime, a workaround is to use polling solution like Stash Pullrequest Builder


Please have a look at Bitbucket Webhooks Troubleshooting to troubleshoot issues with these solutions.


Bitbucket Integration
Documentation of the Webhook To Jenkins for Bitbucket

Have more questions? Submit a request


  • 4
    Irmantas Marozas

    What exactly allows Bitbucket Webhook to trigger build without providing any authentication in the URL? Is there any authentication process happening behind the scenes?

  • 0
    Philip O'gorman

    When I hit the test button I get : Error: Connection reset,

    What is is the authentication set up needed?

  • 0
    Allan Burdajewicz

    This atlassian plugin send a request to the `/git/notifyCommit` endpoint. As explained in the documentation of the Git plugin, this endpoint does not require authentication.

    In order to troubleshoot this, you can add a Logger to the package `hudson.plugins.git.GitStatus` and check if the notification is received:

      Received notification for uri = ; sha1 = c2dca5be8beffb8843556e876a35e746b03348db ; branches = [master]

    If you encounter any issue, feel free to open a ticket to CloudBees Support.

Please sign in to leave a comment.