]> git.evergreen-ils.org Git - OpenSRF.git/blob - examples/buildbot.cfg
Turn on email and IRC notification about build breaks
[OpenSRF.git] / examples / buildbot.cfg
1 # -*- python -*-
2 # vim: set syntax=python:et:ts=4:sw=4:
3
4 # This is a sample buildmaster config file. It must be installed as
5 # 'master.cfg' in your buildmaster's base directory.
6
7 # This is the dictionary that the buildmaster pays attention to. We also use
8 # a shorter alias to save typing.
9 c = BuildmasterConfig = {}
10
11 ####### BUILDSLAVES
12
13 # The 'slaves' list defines the set of recognized buildslaves. Each element is
14 # a BuildSlave object, specifying a username and password.  The same username and
15 # password must be configured on the slave.
16 from buildbot.buildslave import BuildSlave
17 c['slaves'] = [
18     BuildSlave("opensrf-slave", "XXX", max_builds=1),
19     BuildSlave("eg-slave", "XXX", max_builds=1),
20     BuildSlave("eg-u804", "XXX", max_builds=1),
21     BuildSlave("eg-u1004", "XXX", max_builds=1)
22 ]
23
24 # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
25 # This must match the value configured into the buildslaves (with their
26 # --master option)
27 c['slavePortnum'] = XXX
28
29 # Branches and distros to build
30 OSRF_BRANCHES = ('master', 'rel_1_6', 'rel_2_0')
31 OSRF_DISTROS = [('ubuntu-10.04-x86_64', 'opensrf-slave')]
32 EG_BRANCHES = ('master', 'rel_1_6_1', 'rel_2_0', 'rel_2_1')
33 EG_DISTROS = [
34     ('debian-6.00-x86_64', 'eg-slave'), # UPEI
35     ('ubuntu-8.04-x86', 'eg-u804'),     # GPLS
36     ('ubuntu-10.04-x86', 'eg-u1004')    # GPLS
37 ]
38
39 eg_git = 'git://git.evergreen-ils.org/Evergreen.git'
40 osrf_git = 'git://git.evergreen-ils.org/OpenSRF.git'
41
42 ####### CHANGESOURCES
43
44 # the 'change_source' setting tells the buildmaster how it should find out
45 # about source code changes
46
47 from buildbot.changes import gitpoller
48 c['change_source'] = []
49 for osrf_branch in OSRF_BRANCHES:
50     c['change_source'].append(gitpoller.GitPoller(
51         project='OpenSRF',
52         repourl=osrf_git,
53         workdir='/tmp/buildbot_osrf_' + osrf_branch,
54         branch=osrf_branch
55     ))
56
57 for eg_branch in EG_BRANCHES:
58     c['change_source'].append(gitpoller.GitPoller(
59         project='Evergreen',
60         repourl=eg_git,
61         workdir='/tmp/buildbot_eg_' + eg_branch,
62         branch=eg_branch
63     ))
64
65 ####### FILTERS
66 from buildbot.schedulers.filter import ChangeFilter
67 master_filter = ChangeFilter(project='OpenSRF', branch="master")
68 rel_1_6_filter = ChangeFilter(project='OpenSRF', branch="rel_1_6")
69 rel_2_0_filter = ChangeFilter(project='OpenSRF', branch="rel_2_0")
70 eg_rel_1_6_1_filter = ChangeFilter(project='Evergreen', branch="rel_1_6_1")
71 eg_rel_2_0_filter = ChangeFilter(project='Evergreen', branch="rel_2_0")
72 eg_rel_2_1_filter = ChangeFilter(project='Evergreen', branch="rel_2_1")
73 eg_master_filter = ChangeFilter(project='Evergreen', branch="master")
74
75 ####### SCHEDULERS
76
77 # Configure the Schedulers, which decide how to react to incoming changes.  In this
78 # case, just kick off a 'runtests' build
79
80 from buildbot.scheduler import Scheduler
81 c['schedulers'] = []
82 c['schedulers'].append(Scheduler(name="osrf-master-full",
83             treeStableTimer=300,
84             change_filter=master_filter,
85             builderNames=["osrf-master-ubuntu-10.04-x86_64"]))
86
87 c['schedulers'].append(Scheduler(name="osrf-rel_1_6",
88             treeStableTimer=300,
89             change_filter=rel_1_6_filter,
90             builderNames=["osrf-rel_1_6-ubuntu-10.04-x86_64"]))
91
92 c['schedulers'].append(Scheduler(name="osrf-rel_2_0",
93             treeStableTimer=300,
94             change_filter=rel_2_0_filter,
95             builderNames=["osrf-rel_2_0-ubuntu-10.04-x86_64"]))
96
97 c['schedulers'].append(Scheduler(name="evergreen-rel_1_6_1",
98             treeStableTimer=300,
99             change_filter=eg_rel_1_6_1_filter,
100             builderNames=[
101                 "evergreen-rel_1_6_1-debian-6.00-x86_64",
102                 "evergreen-rel_1_6_1-ubuntu-8.04-x86",
103                 "evergreen-rel_1_6_1-ubuntu-10.04-x86"
104             ]))
105
106 c['schedulers'].append(Scheduler(name="evergreen-rel_2_0",
107             treeStableTimer=300,
108             change_filter=eg_rel_2_0_filter,
109             builderNames=[
110                 "evergreen-rel_2_0-debian-6.00-x86_64",
111                 "evergreen-rel_2_0-ubuntu-8.04-x86",
112                 "evergreen-rel_2_0-ubuntu-10.04-x86"
113             ]))
114
115 c['schedulers'].append(Scheduler(name="evergreen-rel_2_1",
116             treeStableTimer=300,
117             change_filter=eg_rel_2_1_filter,
118             builderNames=[
119                 "evergreen-rel_2_1-debian-6.00-x86_64",
120                 "evergreen-rel_2_1-ubuntu-8.04-x86",
121                 "evergreen-rel_2_1-ubuntu-10.04-x86"
122             ]))
123
124 c['schedulers'].append(Scheduler(name="evergreen-master",
125             treeStableTimer=300,
126             change_filter=eg_master_filter,
127             builderNames=[
128                 "evergreen-master-debian-6.00-x86_64",
129                 "evergreen-master-ubuntu-8.04-x86",
130                 "evergreen-master-ubuntu-10.04-x86"
131             ]))
132
133 ####### BUILDERS
134
135 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
136 # what steps, and which slaves can execute them.  Note that any particular build will
137 # only take place on one slave.
138
139 from buildbot.process.factory import BuildFactory
140 from buildbot.steps import source 
141 from buildbot.steps import shell
142 from buildbot.steps import python
143 from buildbot.steps import python_twisted
144
145 osrf_factory = BuildFactory()
146 # check out the source
147 osrf_factory.addStep(source.Git(
148         repourl=osrf_git
149     )
150 )
151
152 # bootstrap the code
153 osrf_factory.addStep(shell.ShellCommand(command=["./autogen.sh"]))
154
155 # configure (default args for now)
156 osrf_factory.addStep(shell.Configure())
157
158 # compile the code
159 osrf_factory.addStep(shell.Compile(command=["make"]))
160
161 # run the Perl unit tests
162 osrf_factory.addStep(shell.PerlModuleTest(workdir="build/src/perl"))
163
164 # run the Python unit tests (available after rel_1_6)
165 def has_python_unit_test(step):
166     return step.build.getProperty('branch') != 'rel_1_6'
167
168 osrf_factory.addStep(python_twisted.Trial(
169     doStepIf=has_python_unit_test,
170     testpath="build",
171     tests="src/python/tests/json_test.py"))
172
173 # report on the Python code
174 osrf_factory.addStep(python.PyLint(
175     env={"PYTHONPATH": ["src/python"]},
176     flunkOnFailure=False,
177     command=["pylint", 
178         "--output-format=parseable",
179         "src/python/opensrf.py",
180         "src/python/osrf/app.py",
181         "src/python/osrf/cache.py",
182         "src/python/osrf/conf.py",
183         "src/python/osrf/const.py",
184         "src/python/osrf/ex.py",
185         "src/python/osrf/gateway.py",
186         "src/python/osrf/http_translator.py",
187         "src/python/osrf/json.py",
188         "src/python/osrf/log.py",
189         "src/python/osrf/net_obj.py",
190         "src/python/osrf/net.py",
191         "src/python/osrf/server.py",
192         "src/python/osrf/ses.py",
193         "src/python/osrf/set.py",
194         "src/python/osrf/stack.py",
195         "src/python/osrf/system.py",
196         "src/python/osrf/xml_obj.py",
197         "src/python/osrf/apps/example.py"]))
198
199 eg_factory = BuildFactory()
200 # check out the source
201 eg_factory.addStep(source.Git(
202         repourl=eg_git
203     )
204 )
205
206 # bootstrap the code
207 eg_factory.addStep(shell.ShellCommand(command=["./autogen.sh"]))
208
209 # configure (default args for now)
210 eg_factory.addStep(shell.Configure())
211
212 # compile the code
213 eg_factory.addStep(shell.Compile(command=["make"]))
214
215 perldir = 'build/Open-ILS/src/perlmods'
216 class PerlModuleTestMFHDMadness(shell.PerlModuleTest):
217     'Override PerlModuleTest with nonstandard library location for testlib.pm'
218     command = ['prove', '--lib', 'lib', '-I', 'lib/OpenILS/Utils/MFHD/test', '-r', 't']
219     total = 0
220
221 def has_perl_unit_tests(step):
222     'Only run Perl tests if there are tests'
223     if (step.build.getProperty('branch') == 'rel_1_6_1'):
224         return False
225     elif (step.build.getProperty('branch') == 'rel_2_0'):
226         return False
227     return True
228
229 # run the Perl unit tests
230 eg_factory.addStep(PerlModuleTestMFHDMadness(
231     doStepIf=has_perl_unit_tests,
232     workdir=perldir)
233 )
234
235 # report on the Python code
236 eg_factory.addStep(python.PyLint(
237     env={"PYTHONPATH": ["Open-ILS/src/python"]},
238     flunkOnFailure=False,
239     command=["pylint", 
240         "--output-format=parseable",
241         "Open-ILS/src/python/setup.py",
242         "Open-ILS/src/python/oils/const.py",
243         "Open-ILS/src/python/oils/event.py",
244         "Open-ILS/src/python/oils/__init__.py",
245         "Open-ILS/src/python/oils/org.py",
246         "Open-ILS/src/python/oils/srfsh.py",
247         "Open-ILS/src/python/oils/system.py",
248         "Open-ILS/src/python/oils/utils/csedit.py",
249         "Open-ILS/src/python/oils/utils/idl.py",
250         "Open-ILS/src/python/oils/utils/__init__.py",
251         "Open-ILS/src/python/oils/utils/utils.py"
252     ]
253 ))
254
255 from buildbot.config import BuilderConfig
256
257 c['builders'] = []
258
259 for branch in OSRF_BRANCHES:
260     for distro, slave in OSRF_DISTROS:
261         build = "osrf-%s-%s" % (branch, distro)
262         c['builders'].append(BuilderConfig(name=build, slavenames=slave, factory=osrf_factory))
263         
264 for branch in EG_BRANCHES:
265     for distro, slave in EG_DISTROS:
266         build = "evergreen-%s-%s" % (branch, distro)
267         c['builders'].append(BuilderConfig(name=build, slavenames=slave, factory=eg_factory))
268
269 ####### STATUS TARGETS
270
271 # 'status' is a list of Status Targets. The results of each build will be
272 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
273 # including web pages, email senders, and IRC bots.
274
275 c['status'] = []
276
277 from buildbot.status import html
278 from buildbot.status.web import auth, authz
279
280 users = [('XXX', 'XXX'), ('XXX', 'XXX')]
281 authz_cfg = authz.Authz(
282     auth=auth.BasicAuth(users),
283     # change any of these to True to enable; see the manual for more
284     # options
285     gracefulShutdown = False,
286     forceBuild = 'auth', # use this to test your slave once it is set up
287     forceAllBuilds = False,
288     pingBuilder = False,
289     stopBuild = False,
290     stopAllBuilds = False,
291     cancelPendingBuild = False,
292 )
293 c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
294
295 # Send mail when a build is broken
296 from buildbot.status.mail import MailNotifier
297 MN = MailNotifier(
298     fromaddr="buildbot@testing.evergreen-ils.org",
299     sendToInterestedUsers=True,
300     mode='problem'
301 #   , extraRecipients=["dan@coffeecode.net","open-ils-dev@list.georgialibraries.org"]
302 )
303
304 # Uncomment to actually send mail
305 c['status'].append(MN)
306
307 ### IRCBOT
308 from buildbot.status import words
309 IRC = words.IRC("chat.freenode.net", "egbuilder",
310     channels=["#evergreen"],
311     password="XXX",
312     allowForce=False,
313     notify_events={
314         'exception': 1,
315         'successToFailure': 1,
316         'failureToSuccess': 1,
317     })
318 c['status'].append(IRC)
319
320 ####### PROJECT IDENTITY
321
322 # the 'projectName' string will be used to describe the project that this
323 # buildbot is working on. For example, it is used as the title of the
324 # waterfall HTML page. The 'projectURL' string will be used to provide a link
325 # from buildbot HTML pages to your project's home page.
326
327 c['projectName'] = "Evergreen and OpenSRF"
328 c['projectURL'] = "http://evergreen-ils.org/"
329
330 # the 'buildbotURL' string should point to the location where the buildbot's
331 # internal web server (usually the html.WebStatus page) is visible. This
332 # typically uses the port number set in the Waterfall 'status' entry, but
333 # with an externally-visible host name which the buildbot cannot figure out
334 # without some help.
335
336 c['buildbotURL'] = "http://testing.evergreen-ils.org/buildbot/"
337
338 ####### DB URL
339
340 # This specifies what database buildbot uses to store change and scheduler
341 # state.  You can leave this at its default for all but the largest
342 # installations.
343 c['db_url'] = "sqlite:///state.sqlite"
344