We use Github in combination with BuildBot for our continuous integration setup. With this, the Github commit status API comes incredibly handy. We use it to notify Github whether the tests pass or fail for any incoming pull request. Unfortunately the Buildbot Github status target is incredibly chatty and tries to push status updates for any incoming changes on Github. We run multiple sequential and concurrent builds for each commit. So this is something we do not want, mainly because these status notifications will spam our developer chat. Having a list of 5 build status updates for a single commit spam your chat and mailing list is not fun.
The mailing status notifier can be limited using a category filter, unfortunately the GithubStatus doesn’t provide this feature. But we can easily subclass it and reimplement the feature. Note that GitHubStatus is an old style class, so we need to explicitly call the parent constructor and pass self.
from buildbot.status.github import GitHubStatus</code> class FilteredGitHubStatus(GitHubStatus): def __init__(self, tags=None, *args, **kwargs): self.tags = tags GitHubStatus.__init__(self, *args, **kwargs) def builderAdded(self, name, builder): # only subscribe to builders we are interested in if self.tags is not None and builder.category not in self.tags: return None return self # subscribe to this builder sha = Interpolate("%(src::revision)s") gs = FilteredGitHubStatus( token=github_token, repoOwner="myghaccount", repoName="myrepo", sha=sha, tags=["pullrequest"], startDescription='Build started.', endDescription='Build done.') c["status"].append(gs) pull_request_build = BuilderConfig( name="pullrequest-build", slavenames=CONTROL_SLAVES, category="pullrequest", factory=BuildFactory([ShellCommand(command=["echo", '"Hello world"'])), )