| # -*- python -*- |
| # ex: set syntax=python: |
| from importlib import reload |
| |
| # Extend paths to allow loading zorg and config modules. |
| import os, sys |
| # All the configuration files are under the directory |
| # where master.cfg file is. |
| cfg_path = os.path.abspath(os.path.dirname(__file__)) |
| if cfg_path not in sys.path: |
| sys.path.append(cfg_path) |
| # Zorg is 3 levels up. |
| path = os.path.abspath( |
| os.path.join(cfg_path, '..', '..', '..') |
| ) |
| if path not in sys.path: |
| sys.path.append(path) |
| |
| ##print(">>> sys.path={}}".format(sys.path)) # TODO: Remove this later. |
| |
| # This is the dictionary that the buildmaster pays attention to. We also use |
| # a shorter alias to save typing. |
| c = BuildmasterConfig = {} |
| c['buildbotNetUsageData'] = None |
| |
| import config |
| reload(config) |
| |
| ####### Workers |
| |
| c['workers'] = config.workers.get_all() |
| |
| c['protocols'] = {'pb': {'port': 9990}} |
| |
| ####### CHANGESOURCES |
| |
| ##from buildbot.changes.pb import PBChangeSource |
| from zorg.buildbot.changes.llvmgitpoller import LLVMPoller |
| from zorg.buildbot.process import buildrequest |
| reload(buildrequest) |
| |
| from buildbot.plugins import changes |
| |
| c['change_source'] = [] |
| # TODO: Do we want to support a push mode for the changes? Probably not. |
| #c['change_source'].append(PBChangeSource()) |
| c['change_source'].append( |
| LLVMPoller(repourl='https://github.com/llvm/llvm-project.git', |
| workdir='gitpoller-workdir', |
| pollinterval=120)) |
| c['change_source'].append( |
| changes.GitPoller(repourl='https://github.com/llvm/llvm-lnt.git', |
| project='lnt', |
| branch='master', |
| workdir='gitpoller-llvm-lnt', |
| pollinterval=60*60)) |
| |
| c['collapseRequests'] = buildrequest.collapseRequests |
| |
| ####### BUILDERS |
| |
| from buildbot.plugins import util |
| |
| c['builders'] = builders = [ |
| util.BuilderConfig(**b) for b in config.builders.all |
| ] |
| |
| ####### SCHEDULERS |
| |
| c['schedulers'] = config.schedulers.getSingleBranchSchedulers( |
| c['builders']) |
| c['schedulers'].extend(config.schedulers.getForceSchedulers( |
| c['builders'])) |
| |
| ####### BUILDBOT SERVICES |
| |
| # 'services' is a list of BuildbotService items like reporter targets. The |
| # status of each build will be pushed to these targets. buildbot/reporters/*.py |
| # has a variety to choose from, like IRC bots. |
| |
| # Configure MailNotifier, IRC, buildbot.reporters.github.GitHubStatusPush, buildbot.reporters.github.GitHubCommentPush |
| c['services'] = config.status.getReporters() |
| |
| ####### PROJECT IDENTITY |
| |
| c['title'] = config.options.get('Buildbot', 'title') |
| c['titleURL'] = config.options.get('Buildbot', 'title_url') |
| c['buildbotURL'] = config.options.get('Buildbot', 'my_url') |
| |
| # minimalistic config to activate new web UI |
| c['www'] = dict(port=8011, |
| plugins=dict(waterfall_view={}, console_view={}, grid_view={}), # TODO: badges |
| default_page='console', |
| auth=config.auth.getAuth(), |
| authz=config.auth.getAuthz(), |
| #logRotateLength= |
| #maxRotatedFiles= |
| #versions= |
| ) |
| |
| ####### DB URL |
| |
| c['db'] = { |
| 'db_url' : config.options.get('Database', 'db_url'), |
| } |
| |
| ####### RESOURCE USAGE |
| |
| from datetime import timedelta |
| |
| # TODO: Figure out the "changeHorizon" value for our usage. |
| #c["changeHorizon"] = 300 |
| |
| # configure a janitor which will delete all logs older than one month, |
| # and will run on sundays at noon |
| # TODO: Recheck the setting for the production bot. |
| c['configurators'] = [util.JanitorConfigurator( |
| logHorizon=timedelta(weeks=4), # Roughly once a month. |
| hour=12, |
| dayOfWeek=6 |
| )] |