Skip to main content

How to Trigger Multibranch Jobs from Bitbucket Server?

Comments

15 comments

  • Allan Burdajewicz

    Hello @Nitul, the endpoint `/bitbucket-scmsource-hook/notify` is not documented. The plugin was first designed to automatically create the webhook (and only for Bitbucket Cloud). And the documentation did not include reference to this endpoint. Something to improve.

    Hello @Roy, the Bitbucket Branch Source plugin uses the Bitbucket REST API to scan team project (Organization Scan) and branches (Branch Indexing). You can however use the SCM Trait "Checkout Over SSH" to use SSH for pipeline checkout.

    Hello @David, I believe Bitbucket Branch Source supports Personal Access Token authentication (added in Bitbucket Bucket Server 5.5). I am not sure about the Token Authenticator though. If this is a requirement, you could create an improvement issue in JIRA.

    1
  • Denys Digtiar

    Hi Nitul,

    All the typos have already been corrected.

    0
  • K Caola

    The article is titiled "How to trigger Multibranch Jobs from BitBucket server" but the issue is "I want to configure Jenkins and BitBucket Cloud to automatically trigger Multibranch or Bitbcuket Team/Project jobs on changes". Then environment also lists BitBucket Server.

    Is that a typo?

    Or is this actually a how to for BitBucket Cloud AND NOT BitBucket Server?

    0
  • Francisco Vieira

    Hello. I'm trying to configure Jenkins to build upon commit on BitBucket. So far I was only able to do this with the Git Plugin. 

    I followed the steps before, created the multibranch at the folder level, added the BitBucket Branch Source Plugin, created the hook on bitbucket and even tried to use the Bitbucket Server Webhook to Jenkins but nothing worked.

    Any thoughts on this?

    0
  • David Norton

    Will support be added for X-Auth-Token header instead of HTTP Basic auth? Our BitBucket server is behind a single-sign-on provider and username/password auth is not available.

    UPDATE: our Bitbucket server uses the Token Authentication plugin here: https://marketplace.atlassian.com/plugins/com.thundermoose.plugins.stash-token-auth/server/overview

    0
  • Nitul Kukadia

    @Allan Burdajewicz Please correct this typo issue. 

    0
  • Allan Burdajewicz

    @Deepak At the moment, there is no authentication from Bitbucket to Jenkins. Since Bitbucket Branch Source 2.3.0, there is support for the Bitbucket Server Webhook API (see this PR). The Bitbucket native webhook API enables to provide a Secret to authenticate the payload. This could well be an improvement ticket for the Bitbucket Branch Source plugin.

    @Francisco I would suggest that you have a look at Bitbucket Webhooks Troubleshooting and open a support request if you need more help.

    @Alexander Unless you are using an old version of the SCM API plugin (prior to 2.0), a commit will trigger the respective branch job(s) only. The SCM AMI provide an event processing mechanism for fine grained notification.

    0
  • Roy Mammen

    Does the newer version of plugin supports ssh authentication? I would like to use ssh url (ssh://git@bitbucket.mycompany.com:7999/myproject/myrepo.git) instead of http url along with ssh private key from Jenkins credential store for authentication. Apparently the new plugin doesn’t allow me to choose ssh credentials from the credential drop down, and I also dont see the advance ssh port options within the Branch Source setup page within Jenkins. Is it by design? Or I am not looking at the right place?

    Thanks

    0
  • Allan Burdajewicz

    Hi Nitul,

    This article is for Bitbucket Server integration.

    0
  • Deepak Narayanarao

    Hi,

    How is the authentication handled for webhook API call from bitbucket to cloudbees jenkins server?

    0
  • Alexander Moiseenko

    Hi,

    Does sending webhook to /bitbucket-scmsource-hook/notify endpoint triggers every multibranch job to rescan it's repository for new commits or it works like git/notifyCommit endpoint with repo url parameter?

    0
  • Nitul Kukadia

    Ok Allan Burdajewicz.

    Is this details are for BitBucket Cloud or Server?

    0
  • Nitul Kukadia

    Thanks Allan,

    I configured integration successfully with server.

    Is there any official documentation for endpoint?URL: ENKINS_URL/bitbucket-scmsource-hook/notify

    I found JENKINS_URL/bitbucket-hook/  only.

    0
  • Allan Burdajewicz

    Hi,

    You are right. This is a typo issue. This will be corrected soon.

    Thanks!

    0
  • K Caola

    Hi Nitul,

    I managed to get webhooks working using the "Bitbucket Server Webhook to Jenkins" plugin . When you use that you don't need a specific notify URL, just the main url for your jenkins server (such as http://<YourJenkinsServer>.com/). You can find it in one of the admin level panels, "Manage Jenkins" > "Configure System" > "Jenkins Location: Jenkins URL".

    If you have your jenkinsfile in a repository that does not have the webhooks (example, the webhook is in ProjectName repo and the jenkinsfile is in ProjectNameCI) then you need to check the "Omit Branch Name" box. If you have your jenkinsfile in a repository that has the webhooks then leave "Omit Branch Name" box unchecked.

    This is the setup that worked for us.
    For reference, I'm using Jenkins 2.46.1 and BitBucket server 5.5.1
    I hope this helps you!

     

    0

Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.