| 1 |
# -*- python -*- |
|---|
| 2 |
# ex: set syntax=python: |
|---|
| 3 |
|
|---|
| 4 |
# This is a sample buildmaster config file. It must be installed as |
|---|
| 5 |
# 'master.cfg' in your buildmaster's base directory (although the filename |
|---|
| 6 |
# can be changed with the --basedir option to 'mktap buildbot master'). |
|---|
| 7 |
|
|---|
| 8 |
# It has one job: define a dictionary named BuildmasterConfig. This |
|---|
| 9 |
# dictionary has a variety of keys to control different aspects of the |
|---|
| 10 |
# buildmaster. They are documented in docs/config.xhtml . |
|---|
| 11 |
|
|---|
| 12 |
import os.path |
|---|
| 13 |
from buildbot.changes.freshcvs import FreshCVSSource |
|---|
| 14 |
from buildbot.scheduler import Scheduler, Periodic, Nightly |
|---|
| 15 |
from buildbot.process import step, factory |
|---|
| 16 |
from buildbot.status import html |
|---|
| 17 |
s = factory.s |
|---|
| 18 |
|
|---|
| 19 |
import secret |
|---|
| 20 |
|
|---|
| 21 |
# This is the dictionary that the buildmaster pays attention to. We also use |
|---|
| 22 |
# a shorter alias to save typing. |
|---|
| 23 |
c = BuildmasterConfig = {} |
|---|
| 24 |
|
|---|
| 25 |
# the 'bots' list defines the set of allowable buildslaves. Each element is a |
|---|
| 26 |
# tuple of bot-name and bot-password. These correspond to values given to the |
|---|
| 27 |
# buildslave's mktap invocation. |
|---|
| 28 |
c['bots'] = [("soc_x86_rh9", secret.password)] |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
# the 'sources' list tells the buildmaster how it should find out about |
|---|
| 32 |
# source code changes. Any class which implements IChangeSource can be added |
|---|
| 33 |
# to this list: there are several in buildbot/changes/*.py to choose from. |
|---|
| 34 |
|
|---|
| 35 |
c['sources'] = [] |
|---|
| 36 |
|
|---|
| 37 |
# For example, if you had CVSToys installed on your repository, and your |
|---|
| 38 |
# CVSROOT/freshcfg file had an entry like this: |
|---|
| 39 |
#pb = ConfigurationSet([ |
|---|
| 40 |
# (None, None, None, PBService(userpass=('foo', 'bar'), port=4519)), |
|---|
| 41 |
# ]) |
|---|
| 42 |
|
|---|
| 43 |
# then you could use the following buildmaster Change Source to subscribe to |
|---|
| 44 |
# the FreshCVS daemon and be notified on every commit: |
|---|
| 45 |
# |
|---|
| 46 |
#fc_source = FreshCVSSource("cvs.example.com", 4519, "foo", "bar") |
|---|
| 47 |
#c['sources'].append(fc_source) |
|---|
| 48 |
|
|---|
| 49 |
# or, use a PBChangeSource, and then have your repository's commit script run |
|---|
| 50 |
# 'buildbot sendchange', or contrib/svn_buildbot.py, or |
|---|
| 51 |
# contrib/arch_buildbot.py : |
|---|
| 52 |
# |
|---|
| 53 |
#from buildbot.changes.pb import PBChangeSource |
|---|
| 54 |
#c['sources'].append(PBChangeSource()) |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
## configure the Schedulers |
|---|
| 58 |
|
|---|
| 59 |
c['schedulers'] = [ |
|---|
| 60 |
Nightly("every_6_hours", ["x86_rh9_trunk"], hour=[9,15,21,3], minute=0), |
|---|
| 61 |
Nightly("every_6_hours+10min", ["x86_rh9_mk"], hour=[9,15,21,3], minute=10), |
|---|
| 62 |
] |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
# the 'builders' list defines the Builders. Each one is configured with a |
|---|
| 66 |
# dictionary, using the following keys: |
|---|
| 67 |
# name (required): the name used to describe this bilder |
|---|
| 68 |
# slavename (required): which slave to use, must appear in c['bots'] |
|---|
| 69 |
# builddir (required): which subdirectory to run the builder in |
|---|
| 70 |
# factory (required): a BuildFactory to define how the build is run |
|---|
| 71 |
# periodicBuildTime (optional): if set, force a build every N seconds |
|---|
| 72 |
|
|---|
| 73 |
# buildbot/process/factory.py provides several BuildFactory classes you can |
|---|
| 74 |
# start with, which implement build processes for common targets (GNU |
|---|
| 75 |
# autoconf projects, CPAN perl modules, etc). The factory.BuildFactory is the |
|---|
| 76 |
# base class, and is configured with a series of BuildSteps. When the build |
|---|
| 77 |
# is run, the appropriate buildslave is told to execute each Step in turn. |
|---|
| 78 |
|
|---|
| 79 |
# the first BuildStep is typically responsible for obtaining a copy of the |
|---|
| 80 |
# sources. There are source-obtaining Steps in buildbot/process/step.py for |
|---|
| 81 |
# CVS, SVN, and others. |
|---|
| 82 |
|
|---|
| 83 |
make_source = lambda branch: s(step.SVN, mode='update', |
|---|
| 84 |
baseURL='http://svn.pycheesecake.org/', |
|---|
| 85 |
defaultBranch=branch) |
|---|
| 86 |
|
|---|
| 87 |
source_mk = make_source('branches/mk/') |
|---|
| 88 |
source_trunk = make_source('trunk') |
|---|
| 89 |
|
|---|
| 90 |
class StepTest(step.ShellCommand): |
|---|
| 91 |
name = "unit tests" |
|---|
| 92 |
description = ["running unit tests"] |
|---|
| 93 |
descriptionDone = [name] |
|---|
| 94 |
|
|---|
| 95 |
unit_tests = s(StepTest, command="nosetests --with-doctest --doctest-tests --with-coverage") |
|---|
| 96 |
|
|---|
| 97 |
class EpyDocBuild(step.ShellCommand): |
|---|
| 98 |
name = "documentation" |
|---|
| 99 |
description = ["building documentation"] |
|---|
| 100 |
descriptionDone = [name] |
|---|
| 101 |
|
|---|
| 102 |
epydoc_build = lambda doc_dest: s(EpyDocBuild, |
|---|
| 103 |
command="/bin/sh support/generate_docs.sh %s" % doc_dest) |
|---|
| 104 |
|
|---|
| 105 |
class CoverageBuild(step.ShellCommand): |
|---|
| 106 |
name = "coverage" |
|---|
| 107 |
description = ["building coverage statistics"] |
|---|
| 108 |
descriptionDone = [name] |
|---|
| 109 |
|
|---|
| 110 |
coverage_build = lambda doc_dest: s(CoverageBuild, |
|---|
| 111 |
command="/bin/sh support/generate_coverage.sh %s" % doc_dest) |
|---|
| 112 |
|
|---|
| 113 |
make_factory = lambda source, doc_dest: factory.BuildFactory([ |
|---|
| 114 |
source, |
|---|
| 115 |
unit_tests, |
|---|
| 116 |
epydoc_build(doc_dest), |
|---|
| 117 |
coverage_build(doc_dest)]) |
|---|
| 118 |
|
|---|
| 119 |
f_mk = make_factory(source_mk, "/var/www/agilistas/cheesecake/mk") |
|---|
| 120 |
f_trunk = make_factory(source_trunk, "/var/www/agilistas/cheesecake/trunk") |
|---|
| 121 |
|
|---|
| 122 |
c['builders'] = [ |
|---|
| 123 |
{'name': 'x86_rh9_trunk', |
|---|
| 124 |
'slavename': 'soc_x86_rh9', |
|---|
| 125 |
'builddir': 'test-trunk', |
|---|
| 126 |
'factory': f_trunk |
|---|
| 127 |
}, |
|---|
| 128 |
{'name':'x86_rh9_mk', |
|---|
| 129 |
'slavename':'soc_x86_rh9', |
|---|
| 130 |
'builddir':'test-mk', |
|---|
| 131 |
'factory':f_mk |
|---|
| 132 |
}, |
|---|
| 133 |
] |
|---|
| 134 |
|
|---|
| 135 |
# 'slavePortnum' defines the TCP port to listen on. This must match the value |
|---|
| 136 |
# configured into the buildslaves (with their --master option) |
|---|
| 137 |
|
|---|
| 138 |
c['slavePortnum'] = secret.port |
|---|
| 139 |
|
|---|
| 140 |
# 'status' is a list of Status Targets. The results of each build will be |
|---|
| 141 |
# pushed to these targets. buildbot/status/*.py has a variety to choose from, |
|---|
| 142 |
# including web pages, email senders, and IRC bots. |
|---|
| 143 |
|
|---|
| 144 |
c['status'] = [] |
|---|
| 145 |
c['status'].append(html.Waterfall(http_port=8888)) |
|---|
| 146 |
|
|---|
| 147 |
# from buildbot.status import mail |
|---|
| 148 |
# c['status'].append(mail.MailNotifier(fromaddr="buildbot@localhost", |
|---|
| 149 |
# extraRecipients=["builds@example.com"], |
|---|
| 150 |
# sendToInterestedUsers=False)) |
|---|
| 151 |
# from buildbot.status import words |
|---|
| 152 |
# c['status'].append(words.IRC(host="irc.example.com", nick="bb", |
|---|
| 153 |
# channels=["#example"])) |
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
# if you set 'debugPassword', then you can connect to the buildmaster with |
|---|
| 157 |
# the diagnostic tool in contrib/debugclient.py . From this tool, you can |
|---|
| 158 |
# manually force builds and inject changes, which may be useful for testing |
|---|
| 159 |
# your buildmaster without actually commiting changes to your repository (or |
|---|
| 160 |
# before you have a functioning 'sources' set up). The debug tool uses the |
|---|
| 161 |
# same port number as the slaves do: 'slavePortnum'. |
|---|
| 162 |
|
|---|
| 163 |
#c['debugPassword'] = "debugpassword" |
|---|
| 164 |
|
|---|
| 165 |
# if you set 'manhole', you can telnet into the buildmaster and get an |
|---|
| 166 |
# interactive python shell, which may be useful for debugging buildbot |
|---|
| 167 |
# internals. It is probably only useful for buildbot developers. |
|---|
| 168 |
#from buildbot.master import Manhole |
|---|
| 169 |
#c['manhole'] = Manhole(9999, "admin", "password") |
|---|
| 170 |
|
|---|
| 171 |
# the 'projectName' string will be used to describe the project that this |
|---|
| 172 |
# buildbot is working on. For example, it is used as the title of the |
|---|
| 173 |
# waterfall HTML page. The 'projectURL' string will be used to provide a link |
|---|
| 174 |
# from buildbot HTML pages to your project's home page. |
|---|
| 175 |
|
|---|
| 176 |
c['projectName'] = "Cheesecake" |
|---|
| 177 |
c['projectURL'] = "http://pycheesecake.org/" |
|---|
| 178 |
|
|---|
| 179 |
# the 'buildbotURL' string should point to the location where the buildbot's |
|---|
| 180 |
# internal web server (usually the html.Waterfall page) is visible. This |
|---|
| 181 |
# typically uses the port number set in the Waterfall 'status' entry, but |
|---|
| 182 |
# with an externally-visible host name which the buildbot cannot figure out |
|---|
| 183 |
# without some help. |
|---|
| 184 |
|
|---|
| 185 |
c['buildbotURL'] = "http://agilistas.org:8888" |
|---|