diff --git a/master-bintars/master.cfg b/master-bintars/master.cfg index 22dd4327..c86fb505 100644 --- a/master-bintars/master.cfg +++ b/master-bintars/master.cfg @@ -21,7 +21,7 @@ sys.setrecursionlimit(10000) from common_factories import * from constants import * from locks import * -from schedulers_definition import * +from schedulers_definition import SCHEDULERS from utils import * FQDN = os.getenv("BUILDMASTER_WG_IP", default="100.64.100.1") @@ -97,7 +97,7 @@ c["buildbotNetUsageData"] = None ####### SCHEDULERS # Configure the Schedulers, which decide how to react to incoming changes. -c["schedulers"] = getSchedulers() +c["schedulers"] = SCHEDULERS ####### WORKERS diff --git a/master-docker-nonstandard-2/master.cfg b/master-docker-nonstandard-2/master.cfg index fb8b6305..ce03008f 100644 --- a/master-docker-nonstandard-2/master.cfg +++ b/master-docker-nonstandard-2/master.cfg @@ -20,7 +20,7 @@ sys.setrecursionlimit(10000) from common_factories import * from constants import * from locks import * -from schedulers_definition import * +from schedulers_definition import SCHEDULERS from utils import * FQDN = os.getenv("BUILDMASTER_WG_IP", default="100.64.100.1") @@ -95,7 +95,7 @@ c["buildbotNetUsageData"] = None ####### SCHEDULERS # Configure the Schedulers, which decide how to react to incoming changes. -c["schedulers"] = getSchedulers() +c["schedulers"] = SCHEDULERS ####### WORKERS diff --git a/master-docker-nonstandard/master.cfg b/master-docker-nonstandard/master.cfg index 992739a7..ab7c3e79 100644 --- a/master-docker-nonstandard/master.cfg +++ b/master-docker-nonstandard/master.cfg @@ -20,7 +20,7 @@ sys.setrecursionlimit(10000) from common_factories import * from constants import * from locks import * -from schedulers_definition import * +from schedulers_definition import SCHEDULERS from utils import * FQDN = os.getenv("BUILDMASTER_WG_IP", default="100.64.100.1") @@ -95,7 +95,7 @@ c["buildbotNetUsageData"] = None ####### SCHEDULERS # Configure the Schedulers, which decide how to react to incoming changes. -c["schedulers"] = getSchedulers() +c["schedulers"] = SCHEDULERS ####### WORKERS diff --git a/master-nonlatent/master.cfg b/master-nonlatent/master.cfg index beb77370..68c29ce8 100644 --- a/master-nonlatent/master.cfg +++ b/master-nonlatent/master.cfg @@ -19,7 +19,7 @@ sys.setrecursionlimit(10000) sys.path.insert(0, "/srv/buildbot/master") from common_factories import * from locks import * -from schedulers_definition import * +from schedulers_definition import SCHEDULERS from utils import * ####### VARIABLES @@ -92,7 +92,7 @@ c["prioritizeBuilders"] = prioritizeBuilders ####### SCHEDULERS # Configure the Schedulers, which decide how to react to incoming changes. -c["schedulers"] = getSchedulers() +c["schedulers"] = SCHEDULERS ####### WORKERS diff --git a/master-protected-branches/master.cfg b/master-protected-branches/master.cfg index 91b7aa5b..5bcb9ade 100644 --- a/master-protected-branches/master.cfg +++ b/master-protected-branches/master.cfg @@ -21,7 +21,7 @@ sys.path.insert(0, "/srv/buildbot/master") from constants import * from utils import * from locks import * -from schedulers_definition import * +from schedulers_definition import SCHEDULERS from common_factories import * # This is the dictionary that the buildmaster pays attention to. We also use @@ -94,7 +94,7 @@ c["buildbotNetUsageData"] = None ####### SCHEDULERS # Configure the Schedulers, which decide how to react to incoming changes. -c["schedulers"] = getSchedulers() +c["schedulers"] = SCHEDULERS ####### WORKERS diff --git a/master.cfg b/master.cfg index 1ec15fcc..ea3a4eb4 100644 --- a/master.cfg +++ b/master.cfg @@ -21,7 +21,7 @@ sys.path.insert(0, "/srv/buildbot/master") from common_factories import * from constants import * from locks import * -from schedulers_definition import * +from schedulers_definition import SCHEDULERS from utils import * with open("master-config.yaml", "r") as f: @@ -97,7 +97,7 @@ c["buildbotNetUsageData"] = None ####### SCHEDULERS # Configure the Schedulers, which decide how to react to incoming changes. -c["schedulers"] = getSchedulers() +c["schedulers"] = SCHEDULERS ####### WORKERS diff --git a/schedulers_definition.py b/schedulers_definition.py index f8edb0ee..e58fa9c8 100644 --- a/schedulers_definition.py +++ b/schedulers_definition.py @@ -1,3 +1,4 @@ +from buildbot.interfaces import IProperties from buildbot.plugins import schedulers, util from constants import ( builders_autobake, @@ -12,56 +13,48 @@ ) -####### SCHEDULER HELPER FUNCTIONS +############################ +# SCHEDULER HELPER FUNCTIONS +############################ @util.renderer -def getBranchBuilderNames(props): - mBranch = props.getProperty("master_branch") - - builders = list( - filter(lambda x: x not in github_status_builders, supportedPlatforms[mBranch]) - ) - - return builders +def branchBuilders(props: IProperties) -> list[str]: + master_branch = props.getProperty("master_branch") + builders = supportedPlatforms[master_branch] + return list(filter(lambda x: x not in github_status_builders, builders)) @util.renderer -def getProtectedBuilderNames(props): - mBranch = props.getProperty("master_branch") - - builders = list( - filter(lambda x: x in supportedPlatforms[mBranch], github_status_builders) - ) - - return builders +def protectedBranchBuilders(props: IProperties) -> list[str]: + master_branch = props.getProperty("master_branch") + builders = supportedPlatforms[master_branch] + return list(filter(lambda x: x in builders, github_status_builders)) @util.renderer -def getAutobakeBuilderNames(props): - builderName = props.getProperty("parentbuildername") +def autobakeBuilders(props: IProperties) -> list[str]: + builder_name = props.getProperty("parentbuildername") for b in builders_autobake: - if builderName in b: + if builder_name in b: return [b] return [] @util.renderer -def getBigtestBuilderNames(props): - builderName = str(props.getProperty("parentbuildername")) - +def bigtestBuilders(props: IProperties) -> list[str]: + builder_name = props.getProperty("parentbuildername") for b in builders_big: - if builderName in b: + if builder_name in b: return [b] return [] @util.renderer -def getInstallBuilderNames(props): - builderName = str(props.getProperty("parentbuildername")) - +def installBuilders(props: IProperties) -> list[str]: + builder_name = props.getProperty("parentbuildername") for b in builders_install: - if builderName in b: + if builder_name in b: builders = [b] - if "rhel" in builderName: + if "rhel" in builder_name: builders.append(b.replace("rhel", "almalinux")) builders.append(b.replace("rhel", "rockylinux")) return builders @@ -69,92 +62,52 @@ def getInstallBuilderNames(props): @util.renderer -def getUpgradeBuilderNames(props): - builderName = str(props.getProperty("parentbuildername")) - - builds = [] +def upgradeBuilders(props: IProperties) -> list[str]: + builder_name = props.getProperty("parentbuildername") + builders = [] for b in builders_upgrade: - if builderName in b: - if "rhel" in builderName: - builds.append(b.replace("rhel", "almalinux")) - builds.append(b.replace("rhel", "rockylinux")) - builds.append(b) - return builds + if builder_name in b: + if "rhel" in builder_name: + builders.append(b.replace("rhel", "almalinux")) + builders.append(b.replace("rhel", "rockylinux")) + builders.append(b) + return builders @util.renderer -def getEcoBuilderNames(props): - builderName = str(props.getProperty("parentbuildername")) - - builds = [] +def ecoBuilders(props: IProperties) -> list[str]: + builder_name = props.getProperty("parentbuildername") + builders = [] for b in builders_eco: - if builderName in b: - builds.append(b) - return builds + if builder_name in b: + builders.append(b) + return builders @util.renderer -def getDockerLibraryNames(props): +def dockerLibraryBuilders(props: IProperties) -> list[str]: return builders_dockerlibrary[0] @util.renderer -def getWordpressNames(props): +def wordpressBuilders(props: IProperties) -> list[str]: return builders_wordpress[0] -def getSchedulers(): - l = [] - - l.append( - schedulers.Triggerable( - name="s_upstream_all", builderNames=getBranchBuilderNames - ) - ) - - schedulerProtectedBranches = schedulers.Triggerable( - name="s_protected_branches", builderNames=getProtectedBuilderNames - ) - l.append(schedulerProtectedBranches) - - schedulerPackages = schedulers.Triggerable( - name="s_packages", builderNames=getAutobakeBuilderNames - ) - l.append(schedulerPackages) - - schedulerBigtests = schedulers.Triggerable( - name="s_bigtest", builderNames=getBigtestBuilderNames - ) - l.append(schedulerBigtests) - - schedulerInstall = schedulers.Triggerable( - name="s_install", builderNames=getInstallBuilderNames - ) - l.append(schedulerInstall) - - schedulerUpgrade = schedulers.Triggerable( - name="s_upgrade", builderNames=getUpgradeBuilderNames - ) - l.append(schedulerUpgrade) - - schedulerEco = schedulers.Triggerable(name="s_eco", builderNames=getEcoBuilderNames) - l.append(schedulerEco) - - schedulerDockerlibrary = schedulers.Triggerable( - name="s_dockerlibrary", builderNames=getDockerLibraryNames - ) - l.append(schedulerDockerlibrary) - - l.append(schedulers.Triggerable(name="s_wordpress", builderNames=getWordpressNames)) - - l.append( - schedulers.Triggerable(name="s_release_prep", builderNames=["release-prep"]) - ) - - l.append( - schedulers.Triggerable( - name="s_jepsen", builderNames=["amd64-ubuntu-2204-jepsen-mariadb"] - ) - ) - - return l +SCHEDULERS = [ + schedulers.Triggerable(name="s_upstream_all", builderNames=branchBuilders), + schedulers.Triggerable( + name="s_protected_branches", builderNames=protectedBranchBuilders + ), + schedulers.Triggerable(name="s_packages", builderNames=autobakeBuilders), + schedulers.Triggerable(name="s_bigtest", builderNames=bigtestBuilders), + schedulers.Triggerable(name="s_install", builderNames=installBuilders), + schedulers.Triggerable(name="s_upgrade", builderNames=upgradeBuilders), + schedulers.Triggerable(name="s_eco", builderNames=ecoBuilders), + schedulers.Triggerable(name="s_dockerlibrary", builderNames=dockerLibraryBuilders), + schedulers.Triggerable(name="s_wordpress", builderNames=wordpressBuilders), + schedulers.Triggerable(name="s_release_prep", builderNames=["release-prep"]), + schedulers.Triggerable( + name="s_jepsen", builderNames=["amd64-ubuntu-2204-jepsen-mariadb"] + ), +]