from buildbot.plugins import reporters
c['services'].append(reporters.BitbucketStatusPush('oauth_key', 'oauth_secret'))
BitbucketStatusPush
publishes build status using the Bitbucket Build Status API. The build status is published to a specific commit SHA in Bitbucket. By default, it tracks the last build for each builder and each commit built.
It requires txrequests package to allow interaction with the Bitbucket REST and OAuth APIs.
It uses OAuth 2.x to authenticate with Bitbucket. To enable this, you need to go to your Bitbucket Settings -> OAuth page. Click "Add consumer". Give the new consumer a name, e.g. buildbot, and put in any URL as the callback (this is needed for Oauth 2.x, but it's not used by this reporter), e.g. http://localhost:8010/callback. Give the consumer Repositories:Write access. After creating the consumer, you will then be able to see the OAuth key and secret.
For example, the following reporter
from buildbot.plugins import reporters
reporters.BitbucketStatusPush(
'oauth_key', 'oauth_secret',
status_key=Interpolate("%(prop:buildername)s/%(prop:buildnumber)s"),
status_name=Interpolate("%(prop:buildername)s/%(prop:buildnumber)s"),
generators=[
reporters.BuildStartEndStatusGenerator(
start_formatter=reporters.MessageFormatter(subject="{{ status_detected }}"),
end_formatter=reporters.MessageFormatter(subject="{{ status_detected }}"))
])
c['services'].append(ss)
produces the build statuses below when a build stars and ends, respectively.