Add context field to GitHubStatus updates
https://github.com/buildbot/buildbot/pull/1721
--- buildbot/status/github.py.orig
+++ buildbot/status/github.py
@@ -59,7 +60,7 @@ class GitHubStatus(StatusReceiverMultiService):
def __init__(self, token, repoOwner, repoName, sha=None,
startDescription=None, endDescription=None,
+ baseURL=None, context=None):
@@ -71,6 +72,7 @@ def __init__(self, token, repoOwner, repoName, sha=None,
self._sha = sha or Interpolate("%(src::revision)s")
self._repoOwner = repoOwner
self._repoName = repoName
+ self._context = context or Interpolate("buildbot/%(prop:buildername)s")
self._startDescription = startDescription or "Build started."
self._endDescription = endDescription or "Build done."
@@ -166,10 +168,11 @@ def _getGitHubRepoProperties(self, build):
Return a dictionary with GitHub related properties from `build`.
- repoOwner, repoName, sha = yield defer.gatherResults([
+ repoOwner, repoName, sha, context = yield defer.gatherResults([
build.render(self._repoOwner),
build.render(self._repoName),
+ build.render(self._context),
if not repoOwner or not repoName:
@@ -185,6 +188,7 @@ def _getGitHubRepoProperties(self, build):
'targetURL': self._status.getURLForThing(build),
'buildNumber': str(build.getNumber()),
defer.returnValue(result)
@@ -200,6 +204,7 @@ def _sendGitHubStatus(self, status):
state=status['state'].encode('utf-8'),
target_url=status['targetURL'].encode('utf-8'),
description=status['description'].encode('utf-8'),
+ context=status['context'].encode('utf-8'),
--- buildbot/test/unit/test_status_github.py.orig
+++ buildbot/test/unit/test_status_github.py
@@ -132,6 +132,8 @@ def test_initialization_required_arguments(self):
self.assertEqual(status._sha, Interpolate("%(src::revision)s"))
self.assertEqual(status._startDescription, "Build started.")
self.assertEqual(status._endDescription, "Build done.")
+ self.assertEqual(status._context,
+ Interpolate("buildbot/%(prop:buildername)s"))
def test_custom_github_url(self):
@@ -271,6 +273,7 @@ def test_sendStartStatus_ok(self):