From b0feb4ea90884c94387472137b114b954b2d1b7d Mon Sep 17 00:00:00 2001 From: Muzahid Date: Thu, 3 Feb 2022 21:54:11 +0530 Subject: [PATCH] fixing configuration issues --- multibuild.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/multibuild.py b/multibuild.py index 9355421..900f183 100644 --- a/multibuild.py +++ b/multibuild.py @@ -10,8 +10,8 @@ Requires docker # TODO: write hook job, maybe also a dockerfile? # TODO: what to do about non-docker jobs -from os import walk -from os.path import exists, isfile, join, listdir +from os import listdir, walk +from os.path import exists, isfile, join import requests import re from buildbot.plugins import steps, util @@ -66,6 +66,7 @@ ENTRYPOINT /usr/local/bin/buildbot_entrypoint.sh "$BUILDMASTER" "$WORKERNAME" "$ """ +path =".buildbot" def list_jobs(directory=".buildbot"): """ @@ -92,11 +93,11 @@ def find_artifacts(directory="out"): return join(directory, _) -def get_dockerfile_contents(path, os_codename): +def get_dockerfile_contents(props): """ Read contents of a Dockerfile and add extra contents for the given os_codename """ - with open(path, "r") as file: + with open(join(path + props.getProperty('jobname', default=None)), "r") as file: contents = file.read() # remove any line containing CMD or ENTRYFILE keywords re.sub(r"(?m)^(CMD|ENTRYFILE).*$", "", contents) @@ -104,7 +105,7 @@ def get_dockerfile_contents(path, os_codename): return contents + { "focal": dockerfile_extra_contents_focal, "bionic": dockerfile_extra_contents_bionic, - }[os_codename] + }[util.Interpolate("%(prop:os_codename)s")] def trigger_child_hooks(buildbotUrl: str, os_codename: str, repository, branch, jobname, directory=".buildbot"): @@ -164,28 +165,28 @@ def add_parent_step(build_factory, jobname, repository, branch): ) -def add_child_build_sh_step(build_factory, job, directory=".buildbot"): +def add_child_build_sh_step(build_factory, directory=".buildbot"): """ Add a step to the build factory """ build_factory.addStep( steps.ShellCommand( - name="build_" + job, - command=["bash", "-c", join(directory, job, "build.sh")], + name="build_" + util.Interpolate("%(prop:jobname)s"), + command=["bash", "-c", join(directory, util.Interpolate("%(prop:jobname)s"), "build.sh")], doStepIf=is_build_script_available, hideStepIf=isnt_build_script_available, ) ) -def add_child_test_sh_step(build_factory, job, directory=".buildbot"): +def add_child_test_sh_step(build_factory, directory=".buildbot"): """ Add a step to the build factory """ build_factory.addStep( steps.ShellCommand( - name="test_" + job, - command=["bash", "-c", join(directory, job, "test.sh")], + name="test_" + util.Interpolate("%(prop:jobname)s"), + command=["bash", "-c", join(directory, util.Interpolate("%(prop:jobname)s"), "test.sh")], doStepIf=is_test_script_available, hideStepIf=isnt_test_script_available, )