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