diff --git a/master-web/master.cfg b/master-web/master.cfg index e51cce9b..68685760 100644 --- a/master-web/master.cfg +++ b/master-web/master.cfg @@ -15,104 +15,120 @@ from datetime import timedelta sys.setrecursionlimit(10000) -sys.path.append(os.getcwd() + '/..') +sys.path.append(os.getcwd() + "/..") from constants import * c = BuildmasterConfig = {} # Load the slave, database passwords and 3rd-party tokens from an external # private file, so that the rest of the configuration can be public. -config = { "private": { } } -exec(open("../master-private.cfg").read(), config, { }) +config = {"private": {}} +exec(open("../master-private.cfg").read(), config, {}) ####### PROJECT IDENTITY -c['title'] = os.getenv('TITLE', default="MariaDB CI") -c['titleURL'] = os.getenv('TITLE_URL', default="https://github.com/MariaDB/server") -c['buildbotURL'] = os.getenv('BUILDMASTER_URL', default="https://buildbot.mariadb.org/") +c["title"] = os.getenv("TITLE", default="MariaDB CI") +c["titleURL"] = os.getenv("TITLE_URL", default="https://github.com/MariaDB/server") +c["buildbotURL"] = os.getenv("BUILDMASTER_URL", default="https://buildbot.mariadb.org/") -port = int(os.getenv('PORT', default="8010")) +port = int(os.getenv("PORT", default="8010")) # minimalistic config to activate web UI -c['www'] = dict(port=port, plugins=dict(waterfall_view={}, console_view={}, grid_view={}), custom_templates_dir='templates') +c["www"] = dict( + port=port, + plugins=dict(waterfall_view={}, console_view={}, grid_view={}), + custom_templates_dir="templates", +) # Github Auth, allow control for MariaDB affiliated accounts -c['www']['authz'] = util.Authz( - allowRules=[ - util.AnyControlEndpointMatcher(role="MariaDB", defaultDeny=True) - ], - roleMatchers=[ - util.RolesFromGroups() - ] +c["www"]["authz"] = util.Authz( + allowRules=[util.AnyControlEndpointMatcher(role="MariaDB", defaultDeny=True)], + roleMatchers=[util.RolesFromGroups()], +) +c["www"]["auth"] = util.GitHubAuth( + config["private"]["gh_mdbauth"]["client"], config["private"]["gh_mdbauth"]["secret"] ) -c['www']['auth'] = util.GitHubAuth(config["private"]["gh_mdbauth"]["client"], config["private"]["gh_mdbauth"]["secret"]) # Sponsor plugin exec(open("../sponsor.py").read()) ####### DB URL -c['db'] = { - 'db_url' : config["private"]["db_url"] -} +c["db"] = {"db_url": config["private"]["db_url"]} ####### Disable net usage reports from being sent to buildbot.net -c['buildbotNetUsageData'] = None +c["buildbotNetUsageData"] = None ####### GitHub hooks # GitHub webhook receiver -c['www']['change_hook_dialects'] = { - 'github': { - 'secret': config["private"]["gh_secret"], - 'strict': True, - } +c["www"]["change_hook_dialects"] = { + "github": { + "secret": config["private"]["gh_secret"], + "strict": True, + } } -c['www']['ui_default_config'] = { - 'Grid.changeFetchLimit': 5, - 'Grid.buildFetchLimit': 50, +c["www"]["ui_default_config"] = { + "Grid.changeFetchLimit": 5, + "Grid.buildFetchLimit": 50, } -c['logEncoding'] = 'utf-8' +c["logEncoding"] = "utf-8" -c['multiMaster'] = True +c["multiMaster"] = True # Need to enable multimaster aware mq. Wamp is the only option for now. -c['mq'] = { - 'type' : 'wamp', - 'router_url': os.getenv('MQ_ROUTER_URL', default='ws://localhost:8085/ws'), - 'realm': 'realm1', +c["mq"] = { + "type": "wamp", + "router_url": os.getenv("MQ_ROUTER_URL", default="ws://localhost:8085/ws"), + "realm": "realm1", # valid are: none, critical, error, warn, info, debug, trace - 'wamp_debug_level' : 'info' + "wamp_debug_level": "info", } # git branch filter using fnmatch import fnmatch + + def upstream_branch_fn(branch): - return branch in branches_main or \ - fnmatch.fnmatch(branch, 'bb-*') or \ - fnmatch.fnmatch(branch, 'st-*') or \ - fnmatch.fnmatch(branch, 'prot-*') or \ - fnmatch.fnmatch(branch, "refs/pull/*") or \ - fnmatch.fnmatch(branch, "preview-10.*") + return ( + branch in branches_main + or fnmatch.fnmatch(branch, "bb-*") + or fnmatch.fnmatch(branch, "st-*") + or fnmatch.fnmatch(branch, "prot-*") + or fnmatch.fnmatch(branch, "refs/pull/*") + or fnmatch.fnmatch(branch, "preview-10.*") + ) + + def staging_branch_fn(branch): - return fnmatch.fnmatch(branch, 'st-*') + return fnmatch.fnmatch(branch, "st-*") + + def fnmatch_any(s, list_of_patterns): return any(fnmatch.fnmatch(s, p) for p in list_of_patterns) -c['schedulers'] = [] + +c["schedulers"] = [] # upstream scheduling schedulerTarball = schedulers.AnyBranchScheduler( - name="s_upstream_tarball", - change_filter=util.ChangeFilter(repository="https://github.com/MariaDB/server", branch_fn=upstream_branch_fn), - treeStableTimer=60, - builderNames=["tarball-docker"]) -c['schedulers'].append(schedulerTarball) + name="s_upstream_tarball", + change_filter=util.ChangeFilter( + repository="https://github.com/MariaDB/server", branch_fn=upstream_branch_fn + ), + treeStableTimer=60, + builderNames=["tarball-docker"], +) +c["schedulers"].append(schedulerTarball) if os.getenv("ENVIRON") == "DEV": schedulerTarball = schedulers.AnyBranchScheduler( - name="s_faust_tarball", - change_filter=util.ChangeFilter(repository="https://github.com/fauust/mariadb-server", branch_fn=upstream_branch_fn), - treeStableTimer=60, - builderNames=["tarball-docker"]) - c['schedulers'].append(schedulerTarball) + name="s_faust_tarball", + change_filter=util.ChangeFilter( + repository="https://github.com/fauust/mariadb-server", + branch_fn=upstream_branch_fn, + ), + treeStableTimer=60, + builderNames=["tarball-docker"], + ) + c["schedulers"].append(schedulerTarball)