view autobot/template/master/master.cfg @ 189:cb9ad0b04140

preliminary passing of platform information from slaves; not yet tested
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 02 Feb 2011 09:11:28 -0800
parents 700693fad00a
children ec60fe53c36c
line wrap: on
line source

# -*- python -*-
# ex: set syntax=python:
c = BuildmasterConfig = {}

####### AUTOBOT CONFIG
import os
from autobot.config import BuildbotIniConfig
config = BuildbotIniConfig(os.path.join(basedir, 'master.ini'))

####### BUILDSLAVES
from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave(slave, config.slaves[slave]['password'])
               for slave in config.slaves]
c['slavePortnum'] = config.master['slaveport']

####### BUILDERS

# change sources
sources = {'git': set(),
           'hg':  set()}

builder_sources = {}
           
# define builder factories
from autobot.projects import factories as factory_dict
from autobot.projects import args
builders = []

for slave in config.slaves:
    for factory in config.slaves[slave]['factories']:

        # get the factory constructor arguments
        factory_args = config.args.get(factory, {}).copy()
        if 'platform' in args[factory]:
            # slave platform information
            factory_args['platform'] = config.slaves[slave]['platform']

        # make a factory
        f = factory_dict[factory](**factory_args)
        
        # define builder
        buildername = '%s - %s' % (factory, slave)
        b = {'name': buildername,
             'slavename': slave,
             'builddir': factory,
             'factory': f,
             }
        builders.append(b)

        # get change sources
        # XXX this should be moved to real code, not pseudo-config
        if not hasattr(f, 'sources'):
            continue
        for source_type in sources:
            _sources = f.sources.get(source_type, [])
            for source, branch in _sources:
                sources[source_type].add((source, branch))
                builder_sources.setdefault((source, branch), []).append(buildername)
    
c['builders'] = builders

####### CHANGESOURCES
from buildbot.changes.pb import PBChangeSource
c['change_source'] = [PBChangeSource()]

from buildbot.changes.gitpoller import GitPoller
from autobot.changes.poller import HgPoller

pollInterval = int(config.master.get('pollInterval', 60))

for repourl, branch in sources['git']:
    c['change_source'].append(GitPoller(
        repourl=repourl,
        pollInterval=pollInterval,
        branch=branch
        ))

for repourl, branch in sources['hg']:
    c['change_source'].append(HgPoller(
        repourl=repourl,
        pollInterval=pollInterval,
        branch=branch))


####### SCHEDULERS
from buildbot.scheduler import Scheduler
from buildbot.schedulers.filter import ChangeFilter
buildernames = [i['name'] for i in builders]
c['schedulers'] = []

treeStableTimer = int(config.master.get('treeStableTimer', 60))

for (source, branch), buildernames in builder_sources.items():
    change_filter = ChangeFilter(repository=source, branch=branch)
    c['schedulers'].append(Scheduler(name="%s#%s" % (source, branch),
                                     treeStableTimer=treeStableTimer,
                                     change_filter=change_filter,
                                     builderNames=buildernames))

####### STATUS TARGETS
c['status'] = []
from buildbot.status import html
from buildbot.status.web.authz import Authz
authz = Authz(forceBuild=True, stopBuild=True)
c['status'].append(html.WebStatus(http_port=config.master['htmlport'],
                                  authz=authz))

####### PROJECT IDENTITY
c['projectName'] = "autobot"
c['projectURL'] = "http://buildbot.sourceforge.net/"
c['buildbotURL'] = "http://localhost:%d/" % config.master['htmlport']