Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

Caution

This page documents the latest, unreleased version of Buildbot. For documentation for released versions, see http://docs.buildbot.net/current/.

2.5.14.2. BitbucketServerCoreAPIStatusPush

from buildbot.plugins import reporters

ss = reporters.BitbucketServerCoreAPIStatusPush('https://bitbucketserver.example.com:8080/',
                                                auth=('bitbucketserver_username',
                                                      'secret_password'))
c['services'].append(ss)

Or using Bitbucket personal access token

from buildbot.plugins import reporters

ss = reporters.BitbucketServerCoreAPIStatusPush('https://bitbucketserver.example.com:8080/',
                                                token='MDM0MjM5NDc2MDxxxxxxxxxxxxxxxxxxxxx')
c['services'].append(ss)

BitbucketServerCoreAPIStatusPush publishes build status using BitbucketServer Core REST API into which it was integrated in Bitbucket Server 7.4. The build status is published to a specific commit SHA in specific repository in Bitbucket Server with some additional information about reference name, build duration, parent relationship and also possibly test results.

It requires txrequests package to allow interaction with Bitbucket Server REST API.

class BitbucketServerCoreAPIStatusPush(base_url, token=None, auth=None, name=None, statusSuffix=None, generators=None, key=None, parentName=None, buildNumber=None, ref=None, duration=None, testResults=None, verbose=False, debug=None, verify=None)
Parameters
  • base_url (string) – The base url of the Bitbucket Server host.

  • token (string) – Bitbucket personal access token (mutually exclusive with auth) (can be a Secret)

  • auth (tuple) – A tuple of Bitbucket Server username and password (mutually exclusive with token) (can be a Secret)

  • string statusName (renderable) – The name that is displayed for this status. If not defined it is constructed to look like “%(prop:buildername)s #%(prop:buildnumber)s”. Or if the plan has a parent plan the default is constructed to look like “<parent’s buildername> #<parent’s buildnumber> >> %(prop:buildername)s #%(prop:buildnumber)s”. Note: Parent information is not accessible as properties for user defined renderer.

  • string statusSuffix (renderable) – Additional string that is appended to statusName. Empty by default. It is useful when the same plan is launched multiple times for a single parent plan instance. This way every instance of the child plan can have unique suffix and thus be more recognizable (than it would be just by the buildnumber).

  • generators (list of IReportGenerator instances) – A list of report generators that will be used to generate reports to be sent by this reporter. Currently the reporter will consider only the report generated by the first generator.

  • string key (renderable) – Passed to Bitbucket Server to differentiate between statuses. A static string can be passed or Interpolate for dynamic substitution. The default key is %(prop:buildername)s.

  • string parentName (renderable) – Defaults to parent’s buildername if plan has a parent plan. Otherwise plan’s own buildername is used as default.

  • string buildNumber (renderable) – The default build number is %(prop:buildername)s.

  • string ref (renderable) – By default branch name from SourceStamp is used. If branch doesn’t start with string refs/ prefix refs/heads/ is added to it’s beginning.

  • int duration (renderable) – Computed for finished builds. Otherwise None. (value in milliseconds)

  • dict testResults (renderable) – Test results can be reported via this parameter. Resulting dictionary must contain keys failed, skipped, successful. By default these keys are filled with values from build properties (tests_failed, tests_skipped, tests_successful) if at least one of the properties is found (missing values will default to 0). Otherwise None. Note: If you want to suppress the default behavior pass renderable that always interpolates to None.

  • verbose (boolean) – If True, logs a message for each successful status push.

  • verify (boolean) – Disable ssl verification for the case you use temporary self signed certificates.

  • debug (boolean) – Logs every requests and their response.