diff --git a/phase1/master.cfg b/phase1/master.cfg index f869dfc..82ebc90 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -17,6 +17,7 @@ from buildbot import locks from buildbot.data import resultspec from buildbot.changes.gitpoller import GitPoller from buildbot.config import BuilderConfig +from buildbot.process import buildstep from buildbot.plugins import reporters from buildbot.plugins import schedulers from buildbot.plugins import steps @@ -758,6 +759,37 @@ c["builders"].append( ) +# CUSTOM CLASS + +# Extension of ShellCommand and sets in property: +# - True: the command succeded +# - False: the command failed +class ShellCommandAndSetProperty(buildstep.ShellMixin, buildstep.BuildStep): + name = "shellandsetproperty" + renderables = ['property'] + + def __init__( + self, + property=None, + **kwargs, + ): + kwargs = self.setupShellMixin(kwargs) + + self.property = property + + super().__init__(**kwargs) + + @defer.inlineCallbacks + def run(self): + cmd = yield self.makeRemoteShellCommand() + + yield self.runCommand(cmd) + + self.setProperty(self.property, not cmd.didFail(), "ShellCommandAndSetProperty Step") + + return cmd.results() + + # NB the phase1 build factory assumes workers are single-build only def prepareFactory(target): (target, subtarget) = target.split("/")