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