blob: 90316a98ed1b1df8e948ec694d2c94f8e16870f6 [file] [log] [blame]
Paul Jakma08815d52017-03-04 14:30:44 +00001# -*- python -*-
2# ex: set syntax=python:
3
4from buildbot.plugins import *
5from buildbot.plugins import buildslave, util
6
7# This is a sample buildmaster config file. It must be installed as
8# 'master.cfg' in your buildmaster's base directory.
9
10# This is the dictionary that the buildmaster pays attention to. We also use
11# a shorter alias to save typing.
12c = BuildmasterConfig = {}
13
14quaggagit = 'git://git.sv.gnu.org/quagga.git'
15
16# password defs
17execfile("pass.cfg")
18
19workers = {
20 "fedora-24": {
21 "os": "Fedora",
22 "version": "24",
23 "vm": False,
24 "pkg": "rpm",
25 },
26 "centos-7": {
27 "os": "CentOS",
28 "version": "7",
29 "vm": False,
30 "pkg": "rpm",
31 },
32 "debian-8": {
33 "os": "Debian",
34 "version": "8",
35 "vm": True,
36 "pkg": "dpkg",
37 "latent": True,
38 "hd_image": "/var/lib/libvirt/images/debian8.qcow2",
39 },
40 "debian-9": {
41 "os": "Debian",
42 "version": "9",
43 "vm": True,
44 "pkg": "dpkg",
45 "latent": True,
46 "hd_image": "/var/lib/libvirt/images/debian9.qcow2",
47 },
48 "freebsd-10": {
49 "os": "FreeBSD",
50 "version": "10",
51 "vm": True,
52 "pkg": "",
53 "latent": True,
54 "hd_image": "/var/lib/libvirt/images/freebsd103.qcow2",
55 },
56 "freebsd-11": {
57 "os": "FreeBSD",
58 "version": "11",
59 "vm": True,
60 "pkg": "",
61 "latent": True,
62 "hd_image": "/var/lib/libvirt/images/freebsd110.qcow2",
63 },
64}
65
66# ensure "latent" is set to false, where not set.
67# add in the passwords
68for kw in workers:
69 w = workers[kw]
70 w["bot"] = "buildbot-" + kw
71 if "latent" not in w:
72 w["latent"] = False
73 w["pass"] = workers_pass[kw]
74
75analyses_builders = [ "clang-analyzer" ]
76
77# default Libvirt session
78for w in (w for w in workers.values () if ("latent" in w)
79 and ("session" not in w)):
80 w["session"] = 'qemu+ssh://buildbot@sagan.jakma.org/system'
81
Paul Jakma390bffa2017-03-05 14:27:11 +000082osbuilders = ["build-" + kw for kw in workers]
Paul Jakma0d917792017-03-05 14:53:59 +000083osfastbuilders = ["build-" + kw for kw in workers if workers[kw]["vm"] == False]
84osslowbuilders = ["build-" + kw for kw in workers if workers[kw]["vm"] == True]
85
86rpmbuilders = ["rpm-" + kw for kw in workers if workers[kw]["pkg"] == "rpm"]
Paul Jakma08815d52017-03-04 14:30:44 +000087
88allbuilders = []
89allbuilders += osbuilders
Paul Jakma0d917792017-03-05 14:53:59 +000090allbuilders += rpmbuilders
Paul Jakma08815d52017-03-04 14:30:44 +000091allbuilders += analyses_builders
92allbuilders += ["commit-builder"]
93allbuilders += ["build-distcheck"]
94
95# Force merging of requests.
Paul Jakma0d917792017-03-05 14:53:59 +000096# c['mergeRequests'] = lambda *args, **kwargs: True
Paul Jakma08815d52017-03-04 14:30:44 +000097
98####### BUILDSLAVES
99c['slaves'] = []
100
101# The 'slaves' list defines the set of recognized buildslaves. Each element is
102# a BuildSlave object, specifying a unique slave name and password. The same
103# slave name and password must be configured on the slave.
104
105for w in (w for w in workers.values() if ("latent" not in w)
106 or (w["latent"] == False)):
107 c['slaves'].append(buildslave.BuildSlave(w["bot"], w["pass"]))
108
109for w in (w for w in workers.values()
110 if ("latent" in w)
111 and w["latent"]
112 and "hd_image" in w):
113 c['slaves'].append(buildslave.LibVirtSlave(
114 w["bot"],
115 w["pass"],
116 util.Connection(w["session"]),
117 w["hd_image"],
118 ))
119
120# 'protocols' contains information about protocols which master will use for
121# communicating with slaves.
122# You must define at least 'port' option that slaves could connect to your master
123# with this protocol.
124# 'port' must match the value configured into the buildslaves (with their
125# --master option)
126c['protocols'] = {'pb': {'port': 9989}}
127
128####### CHANGESOURCES
129
130# the 'change_source' setting tells the buildmaster how it should find out
131# about source code changes. Here we point to the buildbot clone of pyflakes.
132
133c['change_source'] = []
134c['change_source'].append(changes.GitPoller(
135 quaggagit,
136 workdir='gitpoller-workdir',
137 branches=['master','volatile/next'],
138 pollinterval=300))
139
140####### SCHEDULERS
141
142# Configure the Schedulers, which decide how to react to incoming changes.
143
144# We want a first line of 'quick' builds, which then trigger further builds.
145#
146# A control-flow builder, "commit-builder", used to sequence the 'real'
147# sets of builders, via Triggers.
148
149c['schedulers'] = []
150c['schedulers'].append(schedulers.SingleBranchScheduler(
151 name="master-change",
152 change_filter=util.ChangeFilter(branch='master'),
153 treeStableTimer=10,
154 builderNames=[ "commit-builder" ]))
155
156c['schedulers'].append(schedulers.SingleBranchScheduler(
157 name="next-change",
158 change_filter=util.ChangeFilter(
159 branch='volatile/next'),
160 treeStableTimer=10,
161 builderNames=[ "commit-builder" ] ))
162
163# Initial build checks on faster, non-VM
164c['schedulers'].append(schedulers.Triggerable(
165 name="trigger-build-first",
Paul Jakma0d917792017-03-05 14:53:59 +0000166 builderNames=osfastbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000167
168# Build using remaining builders, after firstbuilders.
169c['schedulers'].append(schedulers.Triggerable(
170 name="trigger-build-rest",
Paul Jakma0d917792017-03-05 14:53:59 +0000171 builderNames=osslowbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000172
173# Analyses tools, e.g. CLang Analyzer scan-build
174c['schedulers'].append(schedulers.Triggerable(
175 name="trigger-build-analyses",
176 builderNames=analyses_builders))
177# Dist check
178c['schedulers'].append(schedulers.Triggerable(
179 name="trigger-distcheck",
180 builderNames=["build-distcheck"]))
Paul Jakma390bffa2017-03-05 14:27:11 +0000181# RPM check and build
182c['schedulers'].append(schedulers.Triggerable(
183 name="trigger-rpm",
Paul Jakma0d917792017-03-05 14:53:59 +0000184 builderNames=rpmbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000185
186# Try and force schedulers
187c['schedulers'].append(schedulers.ForceScheduler(
188 name="force",
189 builderNames=allbuilders))
190
191c['schedulers'].append(schedulers.Try_Userpass(
192 name="try",
Paul Jakma0d917792017-03-05 14:53:59 +0000193 builderNames=osbuilders
194 + rpmbuilders
195 + ["build-distcheck",
Paul Jakma08815d52017-03-04 14:30:44 +0000196 "clang-analyzer" ],
197 userpass=users,
198 port=8031))
199
200####### BUILDERS
201c['builders'] = []
202
203# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
204# what steps, and which slaves can execute them. Note that any particular build will
205# only take place on one slave.
206
207common_steps = [
208steps.Git(repourl=quaggagit, mode='incremental'),
209steps.ShellCommand(command=["./update-autotools"]),
210steps.Configure(),
211steps.ShellCommand(command=["make", "clean"]),
212steps.Compile(),
213]
214
Paul Jakma390bffa2017-03-05 14:27:11 +0000215### Default 'check' build, builder instantiated for each OS
Paul Jakma08815d52017-03-04 14:30:44 +0000216
217factory = util.BuildFactory()
218# check out the source
219factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
220factory.addStep(steps.ShellCommand(command=["./update-autotools"],
221 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000222 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000223factory.addStep(steps.Configure())
224factory.addStep(steps.ShellCommand(command=["make", "clean"],
225 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000226 descriptionDone="clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000227factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
228factory.addStep(steps.ShellCommand(command=["make", "check"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000229 description="checking",
230 descriptionDone="make check"))
Paul Jakma08815d52017-03-04 14:30:44 +0000231
Paul Jakma390bffa2017-03-05 14:27:11 +0000232# create builder for every OS, for every buildbot
233# XXX: at moment this assumes 1:1 OS<->bot
Paul Jakma08815d52017-03-04 14:30:44 +0000234for kw in workers:
235 c['builders'].append(util.BuilderConfig(
236 name="build-" + kw,
237 slavenames=workers[kw]["bot"],
238 factory=factory))
239
Paul Jakma390bffa2017-03-05 14:27:11 +0000240### distcheck Builder, executed on any available bot
Paul Jakma08815d52017-03-04 14:30:44 +0000241factory = util.BuildFactory()
242# check out the source
243factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
244factory.addStep(steps.ShellCommand(command=["./update-autotools"],
245 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000246 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000247factory.addStep(steps.Configure())
248factory.addStep(steps.ShellCommand(command=["make", "clean"],
249 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000250 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000251factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000252 description="run make distcheck",
253 descriptionDone="make distcheck"))
Paul Jakma08815d52017-03-04 14:30:44 +0000254c['builders'].append(
255 util.BuilderConfig(name="build-distcheck",
256 slavenames=list(w["bot"] for w in workers.values()),
257 factory=factory,
258))
259
Paul Jakma390bffa2017-03-05 14:27:11 +0000260### LLVM clang-analyzer build, executed on any available non-VM bot
Paul Jakma08815d52017-03-04 14:30:44 +0000261
262f = util.BuildFactory()
263# check out the source
264f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
265 getDescription=True))
266f.addStep(steps.ShellCommand(command=["./update-autotools"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000267 description="run autotools",
268 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000269f.addStep(steps.Configure())
270f.addStep(steps.ShellCommand(command=["make", "clean"],
271 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000272 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000273
274f.addStep(steps.SetProperty(property="clang-id",
275 value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
276
277f.addStep(steps.SetProperty(property="clang-output-dir",
278 value=util.Interpolate("../CLANG-%(prop:clang-id)s")))
279f.addStep(steps.SetProperty(property="clang-uri",
280 value=util.Interpolate("/clang-analyzer/%(prop:clang-id)s")))
281# relative to buildbot master working directory
282f.addStep(steps.SetProperty(property="clang-upload-dir",
283 value=util.Interpolate("public_html/clang-analyzer/%(prop:clang-id)s")))
284
285f.addStep(steps.Compile(command=["scan-build",
286 "-analyze-headers",
287 "-o",
288 util.Interpolate("%(prop:clang-output-dir)s"),
289 "make", "-j", "all"]))
290f.addStep(steps.DirectoryUpload(
291 slavesrc=util.Interpolate("%(prop:clang-output-dir)s"),
292 masterdest = util.Interpolate("%(prop:clang-upload-dir)s"),
293 compress = 'bz2',
294 name = "clang report",
295 url = util.Interpolate("%(prop:clang-uri)s"),
296))
297f.addStep(steps.RemoveDirectory(
298 dir=util.Interpolate("%(prop:clang-output-dir)s")
299))
300
Paul Jakma390bffa2017-03-05 14:27:11 +0000301
Paul Jakma08815d52017-03-04 14:30:44 +0000302c['builders'].append(
303 util.BuilderConfig(name="clang-analyzer",
304 slavenames=list(w["bot"] for w in workers.values() if not w["vm"]),
305 factory=f))
306
Paul Jakma390bffa2017-03-05 14:27:11 +0000307
308### RPM: check and build
309f = util.BuildFactory ()
310
311# check out the source
312f.addStep(steps.Git(repourl=quaggagit, mode='full'))
313f.addStep(steps.ShellCommand(command=["./update-autotools"],
314 description="run autotools",
315 descriptionDone="autotools"))
316f.addStep(steps.Configure())
317f.addStep(steps.ShellCommand(command=["make", "dist"],
318 description="run make dist",
319 descriptionDone="make dist"))
320# not imported somehow
321#f.addStep(steps.RpmLint(fileloc="redhat/quagga.spec"))
322f.addStep(steps.ShellCommand(command=["rpmlint", "-i", "redhat/quagga.spec"],
323 description="run rpmlint",
324 descriptionDone="rpmlint"))
325f.addStep(steps.RpmBuild(specfile="redhat/quagga.spec"))
326# rpmdir=util.Interpolate("%(prop:builddir)s/rpm")))
327
328# XXX: assuming 1:1 OS:buildbot mapping
329for kw in (kw for kw in workers if workers[kw]["pkg"] == "rpm"):
330 c['builders'].append(
331 util.BuilderConfig(name="rpm-" + kw,
332 slavenames="buildbot-" + kw,
333 factory=f
334 )
335 )
336
337### Co-ordination builds used to sequence parallel builds via Triggerable
338
339# to understand this you have to read this list and the Triggered schedulers
340# to see what sets of builds are being sequenced. Bit clunky, but Buildbot
341# doesn't have a way to just specify a pipeline of groups of builders more
342# cleanly.
343
Paul Jakma08815d52017-03-04 14:30:44 +0000344f = util.BuildFactory()
345f.addStep(steps.Trigger (
346 schedulerNames = [ "trigger-build-first" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000347 waitForFinish=True,
348 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000349))
350f.addStep(steps.Trigger (
351 schedulerNames = [ "trigger-build-rest" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000352 waitForFinish=True,
353 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000354))
355f.addStep(steps.Trigger (
356 schedulerNames = [ "trigger-build-analyses", "trigger-distcheck" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000357 waitForFinish=True,
358 updateSourceStamp=True
359))
360f.addStep(steps.Trigger (
361 schedulerNames = [ "trigger-rpm" ],
362 waitForFinish=True,
363 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000364))
365
366c['builders'].append(
367 util.BuilderConfig(name="commit-builder",
Paul Jakma390bffa2017-03-05 14:27:11 +0000368 slavenames=[w["bot"] for w in workers.values() if not w["vm"]],
369 factory=f)
370)
371
Paul Jakma08815d52017-03-04 14:30:44 +0000372
373####### STATUS TARGETS
374
375# 'status' is a list of Status Targets. The results of each build will be
376# pushed to these targets. buildbot/status/*.py has a variety to choose from,
377# including web pages, email senders, and IRC bots.
378
379c['status'] = []
380
381from buildbot.status import html
382from buildbot.status.web import authz, auth
383
384authz_cfg=authz.Authz(
385 # change any of these to True to enable; see the manual for more
386 # options
387 #auth=auth.BasicAuth([("pyflakes","pyflakes")]),
388 auth=util.BasicAuth(users),
389 gracefulShutdown = False,
390 forceBuild = 'auth', # use this to test your slave once it is set up
391 forceAllBuilds = 'auth', # ..or this
392 pingBuilder = 'auth',
393 stopBuild = 'auth',
394 stopAllBuilds = 'auth',
395 cancelPendingBuild = 'auth',
396 cancelAllPendingBuilds = 'auth',
397 pauseSlave = 'auth',
398)
399c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
400
401c['status'].append(status.MailNotifier(
402 fromaddr="buildbot@quagga.net",
403 extraRecipients=["paul@jakma.org"],
404 sendToInterestedUsers=False,
405))
406
407c['status'].append (status.IRC(
408 "irc.freenode.net", "bb-quagga",
409 useColors=True,
410 channels=[{"channel": "#quagga"}],
411 notify_events={
412 'exception': 1,
413 'successToFailure': 1,
414 'failureToSuccess': 1,
415 },
416))
417
418####### PROJECT IDENTITY
419
420# the 'title' string will appear at the top of this buildbot
421# installation's html.WebStatus home page (linked to the
422# 'titleURL') and is embedded in the title of the waterfall HTML page.
423
424c['title'] = "Quagga"
425c['titleURL'] = "https://www.quagga.net/"
426
427# the 'buildbotURL' string should point to the location where the buildbot's
428# internal web server (usually the html.WebStatus page) is visible. This
429# typically uses the port number set in the Waterfall 'status' entry, but
430# with an externally-visible host name which the buildbot cannot figure out
431# without some help.
432
433c['buildbotURL'] = "http://buildbot.quagga.net/"
434
435####### DB URL
436
437c['db'] = {
438 # This specifies what database buildbot uses to store its state. You can leave
439 # this at its default for all but the largest installations.
440 'db_url' : "sqlite:///state.sqlite",
441}
442
443#### debug
444c['debugPassword'] = debugPassword