Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from twisted.internet import defer
from buildbot.process.buildstep import BuildStep
from buildbot.status.results import FAILURE
from buildbot.status.results import SUCCESS
class CheckForFailures(BuildStep):
this step fails when any of the given build steps fail
name = 'check_failures'
description = 'Checking'
descriptionDone = 'Checked'
renderables = (
def __init__(self, important_steps=None, **kwargs):
assert isinstance(important_steps, (list, tuple))
assert all(isinstance(step, str) for step in important_steps)
BuildStep.__init__(self, **kwargs)
assert important_steps is not None
# 0.8.x does not support rendering of sets, hence keep the original list/tuple in a hope it's not a set
self.important_steps = important_steps
def run(self):
check the build's steps and fail if any has failed
# let's hope self.important_steps was rendered properly
important_steps = set(self.important_steps)
failed_steps = set()
for step in
if step.isFinished() and step.getResults()[0] == FAILURE:
if important_steps & failed_steps:
yield defer.returnValue(FAILURE)
yield defer.returnValue(SUCCESS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment