[buildbot] phase1: Implement custom step ShellCommandAndSetProperty
LEDE Commits
lede-commits at lists.infradead.org
Mon Nov 18 00:09:42 PST 2024
ynezz pushed a commit to buildbot.git, branch main:
https://git.openwrt.org/b54911df58076545e2be1960dea8f8cb9c03636e
commit b54911df58076545e2be1960dea8f8cb9c03636e
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Wed Nov 13 14:30:13 2024 +0100
phase1: Implement custom step ShellCommandAndSetProperty
Implement custom step ShellCommandAndSetProperty, as an extension of
ShellCommand with the addition of setting a bool property that is set
True or False if the shell command succeeded or not.
Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
phase1/master.cfg | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
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("/")
More information about the lede-commits
mailing list