fixing configuration issues #5

Merged
PeterSurda merged 1 commits from cis-muzahid/buildbot_multibuild:kivy-test into master 2022-02-04 08:20:22 +01:00

View File

@ -10,8 +10,8 @@ Requires docker
# TODO: write hook job, maybe also a dockerfile? # TODO: write hook job, maybe also a dockerfile?
# TODO: what to do about non-docker jobs # TODO: what to do about non-docker jobs
from os import walk from os import listdir, walk
from os.path import exists, isfile, join, listdir from os.path import exists, isfile, join
import requests import requests
import re import re
from buildbot.plugins import steps, util 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"): def list_jobs(directory=".buildbot"):
""" """
@ -92,11 +93,11 @@ def find_artifacts(directory="out"):
return join(directory, _) return join(directory, _)
def get_dockerfile_contents(path, os_codename): def get_dockerfile_contents(props):
PeterSurda marked this conversation as resolved
Review

should be decorated renderer

should be decorated renderer
Review

at least I think, not 100% sure, since we're not calling it directly, it may not be necessary

at least I think, not 100% sure, since we're not calling it directly, it may not be necessary
""" """
Read contents of a Dockerfile and add extra contents for the given os_codename 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() contents = file.read()
# remove any line containing CMD or ENTRYFILE keywords # remove any line containing CMD or ENTRYFILE keywords
re.sub(r"(?m)^(CMD|ENTRYFILE).*$", "", contents) re.sub(r"(?m)^(CMD|ENTRYFILE).*$", "", contents)
@ -104,7 +105,7 @@ def get_dockerfile_contents(path, os_codename):
return contents + { return contents + {
"focal": dockerfile_extra_contents_focal, "focal": dockerfile_extra_contents_focal,
"bionic": dockerfile_extra_contents_bionic, "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"): 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 Add a step to the build factory
""" """
build_factory.addStep( build_factory.addStep(
steps.ShellCommand( steps.ShellCommand(
name="build_" + job, name="build_" + util.Interpolate("%(prop:jobname)s"),
command=["bash", "-c", join(directory, job, "build.sh")], command=["bash", "-c", join(directory, util.Interpolate("%(prop:jobname)s"), "build.sh")],
doStepIf=is_build_script_available, doStepIf=is_build_script_available,
hideStepIf=isnt_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 Add a step to the build factory
""" """
build_factory.addStep( build_factory.addStep(
steps.ShellCommand( steps.ShellCommand(
name="test_" + job, name="test_" + util.Interpolate("%(prop:jobname)s"),
command=["bash", "-c", join(directory, job, "test.sh")], command=["bash", "-c", join(directory, util.Interpolate("%(prop:jobname)s"), "test.sh")],
doStepIf=is_test_script_available, doStepIf=is_test_script_available,
hideStepIf=isnt_test_script_available, hideStepIf=isnt_test_script_available,
) )