Child pages
  • Bitbucket Branch Source Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

View Bitbucket Branch Source on the plugin site for more information.

Multibranch projects and Team/Project folders from Bitbucket Cloud and Server. Please note that this plugin requires a server running BitBucket 4.0 or later; Stash 3.x and earlier are not supported.

Documentation

User guide

 

Configure plugin via Groovy script

Either automatically upon Jenkins post-initialization or through Jenkins script console, set Jenkins Bitbucket Cloud Endpoint global configuration to manage hooks, example:

#!groovy

// imports
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.domains.Domain
import com.cloudbees.plugins.credentials.impl.*
import hudson.util.Secret
import jenkins.model.Jenkins
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.*

// parameters
def bitbucketEndpointKeyParameters = [
  description:  'Bitbucket Cloud Endpoint Key',
  id:           'bitbucket-cloud-endpoint-key',
  secret:       '12345678901234567890',
  userName:     'my-bitbucket-username-here'
]

def bitbucketEndpointParameters = [
  manageHooks:   true,
  credentialsId: bitbucketEndpointKeyParameters.id
]

// get Jenkins instance
Jenkins jenkins = Jenkins.getInstance()

// get credentials domain
def domain = Domain.global()

// get credentials store
def store = jenkins.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore()

// define Bitbucket secret
def bitbucketCloudKey = new UsernamePasswordCredentialsImpl(
  CredentialsScope.GLOBAL,
  bitbucketEndpointKeyParameters.id,
  bitbucketEndpointKeyParameters.description,
  bitbucketEndpointKeyParameters.userName,
  bitbucketEndpointKeyParameters.secret
)

// add credential to store
store.addCredentials(domain, bitbucketCloudKey)

// get Bitbucket endpoint configuration
def bitbucketEndpoint = jenkins.getDescriptor("com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration")

// define Bitbucket cloud endpoint
def bitbucketCloudEndpoint = new BitbucketCloudEndpoint(
  bitbucketEndpointParameters.manageHooks,
  bitbucketEndpointParameters.credentialsId
)

// update endpoint
bitbucketEndpoint.updateEndpoint(bitbucketCloudEndpoint)

// save to disk
jenkins.save()

 

Version History

Version 2.2.12 (July 5, 2018)

  • JENKINS-45997 - Getting issue details... STATUS  Check mergability when retrieving pull requests
  • JENKINS-50314 - Getting issue details... STATUS  Using or not caches (for teams and repositories) is now configurable

Version 2.2.11 (April 25, 2018)

  • JENKINS-45860 - Getting issue details... STATUS  Job DSL compatibility
  • JENKINS-49671 - Getting issue details... STATUS  Allow the use of Jenkinsfile in a folder
  • JENKINS-49709 - Getting issue details... STATUS  Fixes a proxy configuration issue
  • JENKINS-47254 - Getting issue details... STATUS  Support tags discovering

Version 2.2.10 (Febuary 16, 2018)

  • JENKINS-47958 - Getting issue details... STATUS  Filter closed Hg branches out

Version 2.2.9 (January 24, 2018)

  • Switched to using Handy Uri Template
  • Added cache to limit BitBucket API rate hits
  • JENKINS-48206 - Getting issue details... STATUS  Upgraded to HttpClient 4.x
  • JENKINS-47978 - Getting issue details... STATUS  Fixed handling branch name with '/'

Version 2.2.8 (December 18, 2017)

  • Add ability for extension plugins to modify webhook creation / update process
  • Sort the list of repository names alphabetically
  • Fixed spelling error in job configuration form validation
  • Remove limit of 100 API pages when scanning repositories with very many branches
  • JENKINS-48279 - Getting issue details... STATUS  Correctly list contents of directory when there is more than one API page
  • JENKINS-47653 - Getting issue details... STATUS  Make fetching the timestamp of a branch lazy (most users do not need the information and fetching always was negatively impacting checkout performance)
  • JENKINS-45836 - Getting issue details... STATUS  Allow contributors to select repositories that they contribute to
  • JENKINS-45891 - Getting issue details... STATUS  Fix incorrect checkout of PRs from private forked repositories on Bitbucket server 
  • JENKINS-47978 - Getting issue details... STATUS  Fix lightweight checkout when things have / in them
  • JENKINS-38664 - Getting issue details... STATUS  Skip notification if Jenkins does not have a root URL configured

Version 2.2.7 (November 9, 2017)

  • Fix UnknownFormatConversionException introduced in 2.2.6

Version 2.2.6 (November 8, 2017)

 

  • JENKINS-42518 - Getting issue details... STATUS  Provide lightweight checkout capability for bitbucket to avoid repository clone for multi-branch pipeline jobs
  • JENKINS-47824 - Getting issue details... STATUS  If GitSCMSource gives us a GitTagSCMHead try not to turn it into a branch

 

Version 2.2.5 (November 1, 2017)

  • JENKINS-47675 - Getting issue details... STATUS  Fix regression in push event notification for PRs on Bitbucket Server
  • JENKINS-45497 - Getting issue details... STATUS  Switch Bitbucket Cloud to v2 api

Version 2.2.4 (October 20, 2017)

  • PR#62 Fix project/team URL in BitbuckerServer
  • PR#47 Use full build name instead of name for status notifications
  • PR#65 Added a simple sleep and retry loop when rate limiting occurs
  • PR#67 Expose branch tip modification timestamps to extension plugins
  • JENKINS-45775 - Getting issue details... STATUS  Unable to build PR from private fork in BitbucketServer
  • PR#70 Implement missing SCMHead.getPronoun() override

Version 2.2.3 (July 28, 2017)

  • JENKINS-45771 - Getting issue details... STATUS  Disable shallow clone when we know a merge will take place

Version 2.2.3 (July 28, 2017)

  • JENKINS-45771 - Getting issue details... STATUS  Disable shallow clone when we know a merge will take place

Version 2.2.2 (July 20, 2017)

  • JENKINS-45632 - Getting issue details... STATUS  Handle when default branch is not found
  • JENKINS-45676 - Getting issue details... STATUS  Default traits were not populated for newly created Bitbucket teams

Version 2.2.1 (July 18, 2017)

  • JENKINS-45343 Titles within inline help for Behaviors should match the titles in the dropdown

Version 2.2.0 (Jul 17, 2017)

  • JENKINS-43507 Allow SCMSource and SCMNavigator subtypes to share common traits
  • JENKINS-45533 Bitbucket webhook push notification are ignored on trait implementation
  • JENKINS-41190 Bitbucket Cloud API Implementation uses incorrect domain names
  • JENKINS-45467 On upgrade to 2.2.x, if the username password used as checkout credentials then configuration is migrated to an empty SSH Checkout behaviour
  • JENKINS-45436 API to generate (mostly) human readable names of SCM server URLs
  • JENKINS-45434 Add an avatar cache so that SCMs that providing fixed size avatars can convert to Jenkins native sizes
  • JENKINS-45344 Duplicate entries in Trust dropdown
  • JENKINS-43433 Allow SCMSource implementations to expose merge and origin of change request heads
  • JENKINS-44413 Replace configuration of the SSH port with detection from the clone links
  • JENKINS-36890 PR's do not meet the criteria when Include Branches is set

Version 2.1.2 (Mar 16, 2017)

  • JENKINS-42795 Incorrect type mapping of href deserialization in team objects from Bitbucket Cloud

Version 2.1.1 (Mar 9, 2017)

Version 2.1.1-beta-1 (Mar 8, 2017)

Version 2.1.0 (Feb 15, 2017)

  • JENKINS-36029 If there is an API error connecting to BitBucket, do not delete/mark as orphaned all the branches in a multi-branch project in retaliation.
  • JENKINS-42000 If there is an API error connecting to BitBucket, do not delete/mark as orphaned all the projects in an organization folder in retaliation. NOTE: requires an upgrade to Branch API 2.0.6+ to get the complete fix.

Version 2.0.2 (Feb 2, 2017)

  • JENKINS-41464 Contributor metadata action items missing on PRs after index
  • JENKINS-41313 On first index after upgrade to 2.0.0 all open PRs are rebuiltOn first index after upgrade to 2.0.0 all open PRs are rebuilt

Version 2.0.1 (Jan 23, 2017)

Version 2.0.0 (Jan 16, 2017)

Version 1.9 (Dec 28, 2016)

  • Honor non-proxy hosts (JENKINS-39297)
  • Build status API identifier (key) was too long so Bitbucket rejects the request (JENKINS-36874)

Version 1.8 (Sep 20, 2016)

Version 1.7 (Apr 12, 2016) 

  • Bug fix: limited to 25 branches because of pagination.
  • New feature: commit status notifications: In progress.

Version 1.5 (Apr 12, 2016) 

  • New Item categorization support (Jenkins 2.0 readiness).

Version 1.4 (Mar 13, 2016)

  • Initial OSS release.

2 Comments

  1. Does this plugin work with Bitbucket mirrors? If yes, is there any documentation about that?

    Thanks

  2. Is there no way to set "Skip certificate verification" on the wehooks the plugin creates? Because it just doesn't work otherwise. It doesn't like my wildcard certs and people have complained about it being finicky with the types of certs its accepts. This wouldn't be a problem for me if I can just set "Skip certificate verification" from the plugin to avoid the manual step of setting this myself.

Write a comment…