diff mbox series

[yocto-autobuilder2,v2,1/3] runconfig: Add build configuration as properties

Message ID 20250909-contrib-mathieu-build_props-v2-1-14b809f99dfa@bootlin.com
State New
Headers show
Series runconfig: Add build configuration as properties | expand

Commit Message

Mathieu Dubois-Briand Sept. 9, 2025, 2:31 p.m. UTC
Add some important build configuration such as MACHINE or DISTRO to
buildbot build properties.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 steps/runconfig.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/steps/runconfig.py b/steps/runconfig.py
index a6d0dbd42efe..27600231e606 100644
--- a/steps/runconfig.py
+++ b/steps/runconfig.py
@@ -160,7 +160,8 @@  class RunConfigCheckSteps(shell.ShellCommand):
     haltOnFailure = False
     flunkOnFailure = True
     jsonFileName = util.Interpolate("%(prop:builddir)s/runconfig.json")
-    logfiles = {'json': jsonFileName}
+    propertiesFileName = util.Interpolate("%(prop:builddir)s/runconfig-properties.json")
+    logfiles = {'json': jsonFileName, 'properties': propertiesFileName}
 
     def __init__(self, *args, **kwargs):
         self.posttrigger = kwargs.pop("posttrigger")
@@ -171,6 +172,8 @@  class RunConfigCheckSteps(shell.ShellCommand):
 
         self.log_observer_json = logobserver.BufferLogObserver()
         self.addLogObserver('json', self.log_observer_json)
+        self.log_observer_properties = logobserver.BufferLogObserver()
+        self.addLogObserver('properties', self.log_observer_properties)
 
     @defer.inlineCallbacks
     def run(self):
@@ -188,12 +191,21 @@  class RunConfigCheckSteps(shell.ShellCommand):
         # If the command fails, fall back to old style run-config execution
         rc = cmd.results()
         logLines = self.log_observer_json.getStdout()
+        propertiesLines = self.log_observer_properties.getStdout()
         jsonconfig = None
         try:
             jsonconfig = json.loads(logLines)
         except Exception as ex:
             self._addToLog('stderr', 'ERROR: unable to parse data, exception {}: {}'.format(ex.__class__, ex))
 
+        try:
+            properties = json.loads(propertiesLines)
+        except Exception as ex:
+            self._addToLog('stderr', 'INFO: unable to parse properties data, exception {}: {}'.format(ex.__class__, ex))
+        else:
+            for k, v in properties.items():
+                self.setProperty(k, v, "run-config output")
+
         if rc == FAILURE or not jsonconfig:
             steps = [get_runconfig_legacy_step(self.posttrigger)]
         else: