diff --git a/builders.py b/builders.py index 1c8f7a7..58c7c1d 100644 --- a/builders.py +++ b/builders.py @@ -4,7 +4,6 @@ from yoctoabb import config from yoctoabb.steps.writelayerinfo import WriteLayerInfo from yoctoabb.steps.runconfig import get_publish_dest, get_publish_resultdir, get_publish_name, RunConfigCheckSteps from buildbot.process.results import Results, SUCCESS, FAILURE, CANCELLED, WARNINGS, SKIPPED, EXCEPTION, RETRY -from yoctoabb.steps.observer import RunConfigLogObserver from twisted.python import log diff --git a/steps/observer.py b/steps/observer.py index c20da93..25ff0b2 100644 --- a/steps/observer.py +++ b/steps/observer.py @@ -13,23 +13,25 @@ from functools import partial # Monitor the step 1-X logs and stdio, collecting up any warnings and errors seen # and publish them at the end in their own 'logfile' for ease of access to the user # -class RunConfigLogObserver(ShellCommand): +class SimpleLogObserver(ShellCommand): warnOnWarnings = True warnOnFailure = True warnings = 0 errors = 0 - def __init__(self, python=None, maxsteps=10, *args, **kwargs): - ShellCommand.__init__(self, *args, **kwargs) - self.python = python + def __init__(self, maxsteps=10, *args, **kwargs): + super().__init__(*args, **kwargs) self.warningLines = [] self.errorLines = [] + if "description" in kwargs: + self.description = kwargs["description"] + else: + self.description = "run-config" self.addLogObserver('stdio', logobserver.LineConsumerLogObserver(partial(self.logConsumer, 'stdio'))) - for i in range(1, maxsteps): - for j in ['a', 'b', 'c', 'd']: - name = 'step' + str(i) + str(j) - self.addLogObserver(name, logobserver.LineConsumerLogObserver(partial(self.logConsumer, name))) + + def describe(self, done=False): + return self.description def logConsumer(self, logname): while True: @@ -42,8 +44,10 @@ class RunConfigLogObserver(ShellCommand): self.errorLines.append(logname + ": " + line) def commandComplete(self, cmd): - self.addCompleteLog('warnings', '\n'.join(self.warningLines)) - self.addCompleteLog('errors', '\n'.join(self.errorLines)) + if self.warningLines: + self.addCompleteLog('warnings', '\n'.join(self.warningLines)) + if self.errorLines: + self.addCompleteLog('errors', '\n'.join(self.errorLines)) def evaluateCommand(self, cmd): if cmd.didFail() or self.errors: @@ -51,3 +55,12 @@ class RunConfigLogObserver(ShellCommand): if self.warnings: return WARNINGS return SUCCESS + +class RunConfigLogObserver(SimpleLogObserver): + + def __init__(self, maxsteps=10, *args, **kwargs): + super().__init__(*args, **kwargs) + for i in range(1, maxsteps): + for j in ['a', 'b', 'c', 'd']: + name = 'step' + str(i) + str(j) + self.addLogObserver(name, logobserver.LineConsumerLogObserver(partial(self.logConsumer, name))) diff --git a/steps/runconfig.py b/steps/runconfig.py index 177a4d5..2c40cb9 100644 --- a/steps/runconfig.py +++ b/steps/runconfig.py @@ -4,7 +4,7 @@ from buildbot.process import buildstep, logobserver from buildbot.process.results import Results, SUCCESS, FAILURE, CANCELLED, WARNINGS, SKIPPED, EXCEPTION, RETRY from buildbot.steps import shell -from yoctoabb.steps.observer import RunConfigLogObserver +from yoctoabb.steps.observer import RunConfigLogObserver, SimpleLogObserver import json import datetime @@ -141,13 +141,11 @@ def get_runconfig_legacy_step(posttrigger): return step def get_runconfig_step(name, stepname, phase, description, posttrigger): - step = RunConfigLogObserver( + step = SimpleLogObserver( command=get_runconfig_command(posttrigger) + ['--stepname', stepname, '--phase', phase], name=name, description=description, - logfiles=get_buildlogs(maxsteps), lazylogfiles=True, - maxsteps=maxsteps, timeout=16200) # default of 1200s/20min is too short, use 4.5hrs return step