diff mbox series

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

Message ID 20250904-contrib-mathieu-build_props-v1-1-0ffaafcd01cb@bootlin.com
State New
Headers show
Series runconfig: Add build configuration as properties | expand

Commit Message

Mathieu Dubois-Briand Sept. 4, 2025, 3:48 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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/steps/runconfig.py b/steps/runconfig.py
index a6d0dbd42efe..4e1e704f9de8 100644
--- a/steps/runconfig.py
+++ b/steps/runconfig.py
@@ -160,17 +160,22 @@  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")
         self.command = get_runconfig_command(self.posttrigger)
         self.command.append("--json-outputfile")
         self.command.append(self.jsonFileName)
+        self.command.append("--properties-outputfile")
+        self.command.append(self.propertiesFileName)
         super().__init__(*args, **kwargs)
 
         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 +193,17 @@  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)
+            properties = json.loads(propertiesLines)
         except Exception as ex:
             self._addToLog('stderr', 'ERROR: unable to parse data, exception {}: {}'.format(ex.__class__, ex))
 
+        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: