[users at bb.net] How to update a step's summary while it is running

Jaco Naude naude.jaco at gmail.com
Wed Jul 12 05:15:48 UTC 2017


Hello All,

I'm new to Buildbot.

I'm trying to get a custom step to update its status text displayed in the
Waterfall page, and also on the build page itself. (Using Buildbot 0.8.12 -
hence its old style build steps).

I have managed to update the step's completion status, but can't managed to
get it going for the current status while it is still running. I can extend
the text initially shown by specifying a descriptionSuffix, but can't seem
to get it to update at runtime.

This is what I have at the moment:
(based on
http://docs.buildbot.net/0.8.12/manual/customization.html#updating-status-strings
)

A custom build step with a LogLineObserver attached to it. Everytime the
outLineReceived() function on the log observer fires, I call
updateSummary() on the step in the hope that it will update the status text
with what I provide in getCurrentSummary(). However, getCurrentSummary() is
never called (I raise an exception at its start which never fires). I'm
sure the outLineReceived() function is called which I've verified by
raising an exception as a test.

I have also reimplemented the describe() method in the hope that it could
solve the problem.

class TrialTestCaseCounter(LogLineObserver):
    def outLineReceived(self, line):
        self.step.updateSummary()
        #raise TypeError("outLineReceived - %s -
%s"%(self.step.isNewStyle(),line))

class buildMakeStep(ShellCommand):
    _mode = ""
    _results_summary = None
    def __init__(self, mode, command='', **kwargs):
        _mode = mode
        final_command = command.replace("{MODE}",mode)
        kwargs['command'] = [
            'bash', '-c', 'source evn_setup.bash; %s' % final_command
        ]

        ShellCommand.__init__(self, **kwargs)

        self.descriptionDone = ["Builds completed."]
        self.description = ["Building..."]
        self.descriptionSuffix = [self._mode]

        counter = TrialTestCaseCounter()
        self.addLogObserver('stdio', counter)
    def getCurrentSummary(self):
        raise TypeError('getCurrentSummary called')
        desc = self.descriptionDone if done else self.description
        import time
        import datetime
        now = datetime.datetime.now()
        return {"step":'{:%a %H:%M:%S}'.format(now)}
    def describe(self, done=False):
        desc = self.descriptionDone if done else self.description
        import time
        import datetime
        now = datetime.datetime.now()
        self.descriptionSuffix = ['{:%a %H:%M:%S}'.format(now)]

        if self.descriptionSuffix:
            desc = desc[:]
            desc.extend(self.descriptionSuffix)
        return desc

Any ideas on how to get this working would be much appreciated.
Thanks,
Jaco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20170712/27cbebf0/attachment.html>


More information about the users mailing list