commit a7e1ff5e3c12b65022bfaa950b61d9319f57c826
parent 5b13ce0fa6ada7b107e1913de0f054a52c76aebd
Author: Florian Dold <dold@taler.net>
Date: Sat, 5 Sep 2026 01:37:32 +0200
buildbot: apply job configs over defaults
Create a fresh parser for each container job and merge its values over
the standard configuration. Partial configs now retain the default
architecture, and values cannot leak between jobs or builders.
Diffstat:
1 file changed, 23 insertions(+), 27 deletions(-)
diff --git a/buildbot/master.cfg b/buildbot/master.cfg
@@ -948,37 +948,37 @@ WORKERS.append(Worker("container-worker", "container-pass"))
# Container Job Generator Functions
-# Parse config file and save values in a dict
-def ingest_job_config(configPath, jobName):
- configDict = {jobName: {}}
- print(configDict)
- ini.read_string(configPath)
- for key in ini["build"]:
- value = ini['build'][key]
- configDict[jobName][key] = value
- print(configDict)
- configDict.update(configDict)
+# Return the standard configuration for a container job.
+def default_job_config(jobName, repoName):
+ return {jobName: {"HALT_ON_FAILURE": True,
+ "WARN_ON_FAILURE": False,
+ "CONTAINER_BUILD": True,
+ "CONTAINER_NAME": repoName,
+ "CONTAINER_ARCH": "amd64"}}
+
+
+# Parse a job config and apply it as overrides to the standard configuration.
+def ingest_job_config(configText, jobName, repoName):
+ configDict = default_job_config(jobName, repoName)
+ jobIni = configparser.ConfigParser()
+ jobIni.optionxform = str
+ jobIni.read_string(configText)
+ configDict[jobName].update(jobIni["build"])
print(configDict)
return configDict
# Search for configs, and ingest
-def handle_job_config(jobDirPath, jobName, repoName, configPath, configExist):
- print(configPath)
- if configExist == 0:
- print(f"Ingesting Job Config: {configPath}")
- configDict = ingest_job_config(configPath, jobName)
+def handle_job_config(jobName, repoName, configText, configResult):
+ print(configText)
+ if configResult == util.SUCCESS:
+ print(f"Ingesting Job Config: {configText}")
+ configDict = ingest_job_config(configText, jobName, repoName)
print(configDict)
return configDict
else:
print("No job config; Using default params")
- # Set default job config parameters
- configDict = {jobName: {"HALT_ON_FAILURE": True,
- "WARN_ON_FAILURE": False,
- "CONTAINER_BUILD": True,
- "CONTAINER_NAME": repoName,
- "CONTAINER_ARCH": "amd64"}}
- return configDict
+ return default_job_config(jobName, repoName)
class GenerateStagesCommand(buildstep.ShellMixin, steps.BuildStep):
@@ -1028,7 +1028,7 @@ class GenerateStagesCommand(buildstep.ShellMixin, steps.BuildStep):
print(jobDirPath)
self.configDict.update(
handle_job_config(
- jobDirPath, stage, self.REPO_NAME,
+ stage, self.REPO_NAME,
observer.getStdout(), cmd1.results()))
print(self.configDict)
# create a container step for each stage and
@@ -1072,10 +1072,6 @@ container_repos = ["git.gnunet.org/gnunet",
for repo in container_repos:
- # Prepare to read job configs
- ini = configparser.ConfigParser()
- ini.optionxform = str
-
# Factory-wide variables
REPO_NAME = repo.rsplit('/', 1)[1]
REPO_URL = "git://" + repo + ".git"