diff --git a/builders.py b/builders.py index 58c7c1d..289949e 100644 --- a/builders.py +++ b/builders.py @@ -2,7 +2,7 @@ from buildbot.plugins import * 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 yoctoabb.steps.runconfig import get_publish_dest, get_publish_resultdir, get_publish_name, RunConfigCheckSteps, TargetPresent from buildbot.process.results import Results, SUCCESS, FAILURE, CANCELLED, WARNINGS, SKIPPED, EXCEPTION, RETRY from twisted.python import log @@ -53,6 +53,7 @@ def create_builder_factory(): mode='incremental', haltOnFailure=True, name='Fetch yocto-autobuilder-helper')) + f.addStep(TargetPresent()) f.addStep(steps.SetProperties(properties=ensure_props_set)) f.addStep(WriteLayerInfo(name='Write main layerinfo.json', haltOnFailure=True)) f.addStep(steps.ShellCommand( diff --git a/steps/runconfig.py b/steps/runconfig.py index d425c8b..db9130b 100644 --- a/steps/runconfig.py +++ b/steps/runconfig.py @@ -201,3 +201,17 @@ class RunConfigCheckSteps(shell.ShellCommand): except KeyError: log = yield self.addLog(logName) log.addStdout(message) + +class TargetPresent(shell.ShellCommand): + name = "Check if branch needs this target" + command=[util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/target-present"), util.Property("buildername")] + + def evaluateCommand(self, cmd): + # If the command fails, fall back to old style run-config execution + rc = super().evaluateCommand(cmd) + if rc != SUCCESS: + self.finished(SKIPPED) + self.build.results = SKIPPED + self.descriptionDone = "Target not present in branch configuration" + self.build.buildFinished(["Target not present in branch configuration"], SKIPPED) + return SUCCESS