changeset 86:2616a5f49bd3

switch to .ini files for configuration
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 12 Jan 2011 11:29:00 -0800
parents 65c91bf35a36
children d4452281f42a
files autobot/template.py autobot/template/master/master.cfg autobot/template/master/master.ini
diffstat 3 files changed, 36 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/template.py	Wed Jan 12 11:17:03 2011 -0800
+++ b/autobot/template.py	Wed Jan 12 11:29:00 2011 -0800
@@ -54,6 +54,9 @@
         else:
             raise AssertionError("No factory provided")
 
+        # stringify
+        variables['factories'] = ' '.join([i for i in variables['factories'])
+
     def create(self, output, variables):
         command = ['buildbot', 'create-master', output]
         print ' '.join(command)
--- a/autobot/template/master/master.cfg	Wed Jan 12 11:17:03 2011 -0800
+++ b/autobot/template/master/master.cfg	Wed Jan 12 11:29:00 2011 -0800
@@ -2,52 +2,59 @@
 # 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}}", "{{passwd}}")]
-c['slavePortnum'] = {{slaveport}}
+c['slaves'] = [BuildSlave(slave, config.slaves[slave]['password'])
+               for slave in config.slaves]
+c['slavePortnum'] = config.master['slaveport']
 
 ####### CHANGESOURCES
 from buildbot.changes.pb import PBChangeSource
 c['change_source'] = PBChangeSource()
 
-
 ####### BUILDERS
 
 # define builder factories
 from autobot.projects import factories as factory_dict
 builders = []
 
-for factory in {{factories}}:
-    f = factory_dict[factory]()
-    
-    # define builder
-    b = {'name': factory,
-         'slavename': "{{slave}}",
-         'builddir': "full",
-         'factory': f,
-         }
-    builders.append(b)
+for slave in config.slaves:
+    for factory in config.slaves[slave]['factories']:
+        f = factory_dict[factory](**config.args.get(factory, {}))
+        
+        # define builder
+        buildername = '%s - %s' % (factory, slave)
+        b = {'name': buildername,
+             'slavename': slave,
+             'builddir': "full",
+             'factory': f,
+             }
+        builders.append(b)
     
 c['builders'] = builders
 
 ####### SCHEDULERS
 from buildbot.scheduler import Scheduler
-c['schedulers'] = []    # define scheduler
+buildernames = [i['name'] for i in builders]
+c['schedulers'] = []    
 c['schedulers'].append(Scheduler(name="all", branch=None,
                                  treeStableTimer=1,
-                                 builderNames={{factories}}))
-
-
+                                 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={{htmlport}}, authz=authz))
+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:{{htmlport}}/"
+c['buildbotURL'] = "http://localhost:%d/" % config.master['htmlport']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autobot/template/master/master.ini	Wed Jan 12 11:29:00 2011 -0800
@@ -0,0 +1,7 @@
+[:master:]
+factories = {{factories}}
+password  = {{passwd}}
+slaveport = {{slaveport}}
+htmlport  = {{htmlport}}
+
+[slave:{{slave}}]
\ No newline at end of file