[users at bb.net] How to render log as HTML from remote slave?

Steve Hoelzer shoelzer at gmail.com
Fri Jul 28 15:42:31 UTC 2017


I'm still trying to get my custom build step to render a log as HTML.
My previous email below has code that works, but only if the slave is
on the same machine as the master. That seems to be the wrong
approach.

Backing up a bit, I started down this path by setting logfiles={"My
HTML Log": 'log.html'}. This works great for any slave, but renders
the log as plain text instead of HTML. If there is a way to specify
HTML rendering my problem would be solved, but I can't find a way to
do that.

Now I've been looking into log observers and I think I have the right
idea but still can't get it working. Here's my custom log observer:

    class HtmlLogObserver(logobserver.BufferLogObserver):
        def finishReceived(self):
            content = getStdout()
            self.step.addHTMLLog("My HTML Log", content)

And in my custom build step's __init__() I put this line:

    self.addLogObserver('stdio', HtmlLogObserver())

I was expecting to see a new log link on this step in the Buildbot web
interface but that didn't happen. An suggestions?

Also, 'stdio' isn't the correct name/source for the log. How do I get
the log observer to read from a file?

Thanks,
Steve


On Thu, Jul 13, 2017 at 5:22 PM, Steve Hoelzer <shoelzer at gmail.com> wrote:
> I'm running Buildbot 0.8.12 and I have a custom build step based on
> ShellCommand that generates a HTML report. I figured out how to read
> the report and store/link to it using addHTMLLog(). But then I
> discovered that my code only works if master and slave are on the same
> machine.
>
> I've been reading about remote commands, LogObserver, and the logfiles
> parameter but can't figure what I should be doing. Here's my current
> code:
>
>     def finished(self, results):
>         file = os.path.join(self.getProperty('builddir'), self.testReportFile)
>         if os.path.exists(file):
>             with open(file, 'r') as f:
>                 content = f.read()
>         else:
>             content = 'Could not find file "%s"' % file
>         self.addHTMLLog("test report", content)
>         ShellCommand.finished(self, results)
>
> Like I said, this works when master and slave are on the same machine
> (shared file system). What should I do to make it work for any slave?
>
> Thanks,
> Steve


More information about the users mailing list