blob: 899d6fa38a26db342d0319112d72405769998717 [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 },
Paul Jakma203ab892017-03-07 14:54:28 +000064 "oi-hipster": {
65 "os": "OpenIndiana",
66 "version": "hipster",
67 "vm": True,
68 "pkg": "sysv",
69 "latent": True,
70 "hd_image": "/var/lib/libvirt/images/buildbot-oi-hipster.qcow2",
71 },
Paul Jakma08815d52017-03-04 14:30:44 +000072}
73
74# ensure "latent" is set to false, where not set.
75# add in the passwords
76for kw in workers:
77 w = workers[kw]
78 w["bot"] = "buildbot-" + kw
79 if "latent" not in w:
80 w["latent"] = False
81 w["pass"] = workers_pass[kw]
82
83analyses_builders = [ "clang-analyzer" ]
84
85# default Libvirt session
86for w in (w for w in workers.values () if ("latent" in w)
87 and ("session" not in w)):
88 w["session"] = 'qemu+ssh://buildbot@sagan.jakma.org/system'
89
Paul Jakma390bffa2017-03-05 14:27:11 +000090osbuilders = ["build-" + kw for kw in workers]
Paul Jakma0d917792017-03-05 14:53:59 +000091osfastbuilders = ["build-" + kw for kw in workers if workers[kw]["vm"] == False]
92osslowbuilders = ["build-" + kw for kw in workers if workers[kw]["vm"] == True]
93
94rpmbuilders = ["rpm-" + kw for kw in workers if workers[kw]["pkg"] == "rpm"]
Paul Jakma08815d52017-03-04 14:30:44 +000095
96allbuilders = []
97allbuilders += osbuilders
Paul Jakma0d917792017-03-05 14:53:59 +000098allbuilders += rpmbuilders
Paul Jakma08815d52017-03-04 14:30:44 +000099allbuilders += analyses_builders
100allbuilders += ["commit-builder"]
101allbuilders += ["build-distcheck"]
102
103# Force merging of requests.
Paul Jakma0d917792017-03-05 14:53:59 +0000104# c['mergeRequests'] = lambda *args, **kwargs: True
Paul Jakma08815d52017-03-04 14:30:44 +0000105
106####### BUILDSLAVES
107c['slaves'] = []
108
109# The 'slaves' list defines the set of recognized buildslaves. Each element is
110# a BuildSlave object, specifying a unique slave name and password. The same
111# slave name and password must be configured on the slave.
112
113for w in (w for w in workers.values() if ("latent" not in w)
114 or (w["latent"] == False)):
115 c['slaves'].append(buildslave.BuildSlave(w["bot"], w["pass"]))
116
117for w in (w for w in workers.values()
118 if ("latent" in w)
119 and w["latent"]
120 and "hd_image" in w):
121 c['slaves'].append(buildslave.LibVirtSlave(
122 w["bot"],
123 w["pass"],
124 util.Connection(w["session"]),
125 w["hd_image"],
126 ))
127
128# 'protocols' contains information about protocols which master will use for
129# communicating with slaves.
130# You must define at least 'port' option that slaves could connect to your master
131# with this protocol.
132# 'port' must match the value configured into the buildslaves (with their
133# --master option)
134c['protocols'] = {'pb': {'port': 9989}}
135
136####### CHANGESOURCES
137
138# the 'change_source' setting tells the buildmaster how it should find out
139# about source code changes. Here we point to the buildbot clone of pyflakes.
140
141c['change_source'] = []
142c['change_source'].append(changes.GitPoller(
143 quaggagit,
144 workdir='gitpoller-workdir',
145 branches=['master','volatile/next'],
146 pollinterval=300))
147
Paul Jakma72e3b8b2017-03-08 10:27:54 +0000148####### REVISION LINKS
149# associate changesouce repositories to URI templates for code view
150#
151c['revlink'] = util.RevlinkMatch([quaggagit + r"(.*)"],
152 r"http://git.savannah.gnu.org/cgit/quagga.git/commit/?id=%s")
153
Paul Jakma08815d52017-03-04 14:30:44 +0000154####### SCHEDULERS
155
156# Configure the Schedulers, which decide how to react to incoming changes.
157
158# We want a first line of 'quick' builds, which then trigger further builds.
159#
160# A control-flow builder, "commit-builder", used to sequence the 'real'
161# sets of builders, via Triggers.
162
163c['schedulers'] = []
164c['schedulers'].append(schedulers.SingleBranchScheduler(
165 name="master-change",
166 change_filter=util.ChangeFilter(branch='master'),
167 treeStableTimer=10,
168 builderNames=[ "commit-builder" ]))
169
170c['schedulers'].append(schedulers.SingleBranchScheduler(
171 name="next-change",
172 change_filter=util.ChangeFilter(
173 branch='volatile/next'),
174 treeStableTimer=10,
175 builderNames=[ "commit-builder" ] ))
176
177# Initial build checks on faster, non-VM
178c['schedulers'].append(schedulers.Triggerable(
179 name="trigger-build-first",
Paul Jakma0d917792017-03-05 14:53:59 +0000180 builderNames=osfastbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000181
182# Build using remaining builders, after firstbuilders.
183c['schedulers'].append(schedulers.Triggerable(
184 name="trigger-build-rest",
Paul Jakma0d917792017-03-05 14:53:59 +0000185 builderNames=osslowbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000186
187# Analyses tools, e.g. CLang Analyzer scan-build
188c['schedulers'].append(schedulers.Triggerable(
189 name="trigger-build-analyses",
190 builderNames=analyses_builders))
191# Dist check
192c['schedulers'].append(schedulers.Triggerable(
193 name="trigger-distcheck",
194 builderNames=["build-distcheck"]))
Paul Jakma390bffa2017-03-05 14:27:11 +0000195# RPM check and build
196c['schedulers'].append(schedulers.Triggerable(
197 name="trigger-rpm",
Paul Jakma0d917792017-03-05 14:53:59 +0000198 builderNames=rpmbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000199
200# Try and force schedulers
201c['schedulers'].append(schedulers.ForceScheduler(
202 name="force",
203 builderNames=allbuilders))
204
205c['schedulers'].append(schedulers.Try_Userpass(
206 name="try",
Paul Jakma0d917792017-03-05 14:53:59 +0000207 builderNames=osbuilders
208 + rpmbuilders
209 + ["build-distcheck",
Paul Jakma08815d52017-03-04 14:30:44 +0000210 "clang-analyzer" ],
211 userpass=users,
212 port=8031))
213
214####### BUILDERS
215c['builders'] = []
216
217# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
218# what steps, and which slaves can execute them. Note that any particular build will
219# only take place on one slave.
220
221common_steps = [
222steps.Git(repourl=quaggagit, mode='incremental'),
223steps.ShellCommand(command=["./update-autotools"]),
224steps.Configure(),
225steps.ShellCommand(command=["make", "clean"]),
226steps.Compile(),
227]
228
Paul Jakma390bffa2017-03-05 14:27:11 +0000229### Default 'check' build, builder instantiated for each OS
Paul Jakma08815d52017-03-04 14:30:44 +0000230
231factory = util.BuildFactory()
232# check out the source
233factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
234factory.addStep(steps.ShellCommand(command=["./update-autotools"],
235 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000236 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000237factory.addStep(steps.Configure())
238factory.addStep(steps.ShellCommand(command=["make", "clean"],
239 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000240 descriptionDone="clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000241factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
242factory.addStep(steps.ShellCommand(command=["make", "check"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000243 description="checking",
244 descriptionDone="make check"))
Paul Jakma08815d52017-03-04 14:30:44 +0000245
Paul Jakma390bffa2017-03-05 14:27:11 +0000246# create builder for every OS, for every buildbot
247# XXX: at moment this assumes 1:1 OS<->bot
Paul Jakma08815d52017-03-04 14:30:44 +0000248for kw in workers:
249 c['builders'].append(util.BuilderConfig(
250 name="build-" + kw,
251 slavenames=workers[kw]["bot"],
252 factory=factory))
253
Paul Jakma390bffa2017-03-05 14:27:11 +0000254### distcheck Builder, executed on any available bot
Paul Jakma08815d52017-03-04 14:30:44 +0000255factory = util.BuildFactory()
256# check out the source
257factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
258factory.addStep(steps.ShellCommand(command=["./update-autotools"],
259 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000260 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000261factory.addStep(steps.Configure())
262factory.addStep(steps.ShellCommand(command=["make", "clean"],
263 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000264 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000265factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000266 description="run make distcheck",
267 descriptionDone="make distcheck"))
Paul Jakma08815d52017-03-04 14:30:44 +0000268c['builders'].append(
269 util.BuilderConfig(name="build-distcheck",
270 slavenames=list(w["bot"] for w in workers.values()),
271 factory=factory,
272))
273
Paul Jakma390bffa2017-03-05 14:27:11 +0000274### LLVM clang-analyzer build, executed on any available non-VM bot
Paul Jakma08815d52017-03-04 14:30:44 +0000275
276f = util.BuildFactory()
277# check out the source
278f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
279 getDescription=True))
280f.addStep(steps.ShellCommand(command=["./update-autotools"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000281 description="run autotools",
282 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000283f.addStep(steps.Configure())
284f.addStep(steps.ShellCommand(command=["make", "clean"],
285 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000286 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000287
288f.addStep(steps.SetProperty(property="clang-id",
289 value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
290
291f.addStep(steps.SetProperty(property="clang-output-dir",
292 value=util.Interpolate("../CLANG-%(prop:clang-id)s")))
293f.addStep(steps.SetProperty(property="clang-uri",
294 value=util.Interpolate("/clang-analyzer/%(prop:clang-id)s")))
295# relative to buildbot master working directory
296f.addStep(steps.SetProperty(property="clang-upload-dir",
297 value=util.Interpolate("public_html/clang-analyzer/%(prop:clang-id)s")))
298
299f.addStep(steps.Compile(command=["scan-build",
300 "-analyze-headers",
301 "-o",
302 util.Interpolate("%(prop:clang-output-dir)s"),
303 "make", "-j", "all"]))
304f.addStep(steps.DirectoryUpload(
305 slavesrc=util.Interpolate("%(prop:clang-output-dir)s"),
306 masterdest = util.Interpolate("%(prop:clang-upload-dir)s"),
307 compress = 'bz2',
308 name = "clang report",
309 url = util.Interpolate("%(prop:clang-uri)s"),
310))
311f.addStep(steps.RemoveDirectory(
312 dir=util.Interpolate("%(prop:clang-output-dir)s")
313))
314
Paul Jakma390bffa2017-03-05 14:27:11 +0000315
Paul Jakma08815d52017-03-04 14:30:44 +0000316c['builders'].append(
317 util.BuilderConfig(name="clang-analyzer",
318 slavenames=list(w["bot"] for w in workers.values() if not w["vm"]),
319 factory=f))
320
Paul Jakma390bffa2017-03-05 14:27:11 +0000321
322### RPM: check and build
323f = util.BuildFactory ()
324
325# check out the source
326f.addStep(steps.Git(repourl=quaggagit, mode='full'))
327f.addStep(steps.ShellCommand(command=["./update-autotools"],
328 description="run autotools",
329 descriptionDone="autotools"))
330f.addStep(steps.Configure())
331f.addStep(steps.ShellCommand(command=["make", "dist"],
332 description="run make dist",
333 descriptionDone="make dist"))
334# not imported somehow
335#f.addStep(steps.RpmLint(fileloc="redhat/quagga.spec"))
336f.addStep(steps.ShellCommand(command=["rpmlint", "-i", "redhat/quagga.spec"],
337 description="run rpmlint",
338 descriptionDone="rpmlint"))
339f.addStep(steps.RpmBuild(specfile="redhat/quagga.spec"))
340# rpmdir=util.Interpolate("%(prop:builddir)s/rpm")))
341
342# XXX: assuming 1:1 OS:buildbot mapping
343for kw in (kw for kw in workers if workers[kw]["pkg"] == "rpm"):
344 c['builders'].append(
345 util.BuilderConfig(name="rpm-" + kw,
346 slavenames="buildbot-" + kw,
347 factory=f
348 )
349 )
350
351### Co-ordination builds used to sequence parallel builds via Triggerable
352
353# to understand this you have to read this list and the Triggered schedulers
354# to see what sets of builds are being sequenced. Bit clunky, but Buildbot
355# doesn't have a way to just specify a pipeline of groups of builders more
356# cleanly.
357
Paul Jakma08815d52017-03-04 14:30:44 +0000358f = util.BuildFactory()
359f.addStep(steps.Trigger (
360 schedulerNames = [ "trigger-build-first" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000361 waitForFinish=True,
362 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000363))
364f.addStep(steps.Trigger (
365 schedulerNames = [ "trigger-build-rest" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000366 waitForFinish=True,
367 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000368))
369f.addStep(steps.Trigger (
370 schedulerNames = [ "trigger-build-analyses", "trigger-distcheck" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000371 waitForFinish=True,
372 updateSourceStamp=True
373))
374f.addStep(steps.Trigger (
375 schedulerNames = [ "trigger-rpm" ],
376 waitForFinish=True,
377 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000378))
379
380c['builders'].append(
381 util.BuilderConfig(name="commit-builder",
Paul Jakma390bffa2017-03-05 14:27:11 +0000382 slavenames=[w["bot"] for w in workers.values() if not w["vm"]],
383 factory=f)
384)
385
Paul Jakma08815d52017-03-04 14:30:44 +0000386
387####### STATUS TARGETS
388
389# 'status' is a list of Status Targets. The results of each build will be
390# pushed to these targets. buildbot/status/*.py has a variety to choose from,
391# including web pages, email senders, and IRC bots.
392
393c['status'] = []
394
395from buildbot.status import html
396from buildbot.status.web import authz, auth
397
398authz_cfg=authz.Authz(
399 # change any of these to True to enable; see the manual for more
400 # options
401 #auth=auth.BasicAuth([("pyflakes","pyflakes")]),
402 auth=util.BasicAuth(users),
403 gracefulShutdown = False,
404 forceBuild = 'auth', # use this to test your slave once it is set up
405 forceAllBuilds = 'auth', # ..or this
406 pingBuilder = 'auth',
407 stopBuild = 'auth',
408 stopAllBuilds = 'auth',
409 cancelPendingBuild = 'auth',
410 cancelAllPendingBuilds = 'auth',
411 pauseSlave = 'auth',
412)
413c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
414
415c['status'].append(status.MailNotifier(
416 fromaddr="buildbot@quagga.net",
417 extraRecipients=["paul@jakma.org"],
418 sendToInterestedUsers=False,
419))
420
421c['status'].append (status.IRC(
422 "irc.freenode.net", "bb-quagga",
423 useColors=True,
424 channels=[{"channel": "#quagga"}],
425 notify_events={
426 'exception': 1,
427 'successToFailure': 1,
428 'failureToSuccess': 1,
429 },
430))
431
432####### PROJECT IDENTITY
433
434# the 'title' string will appear at the top of this buildbot
435# installation's html.WebStatus home page (linked to the
436# 'titleURL') and is embedded in the title of the waterfall HTML page.
437
438c['title'] = "Quagga"
439c['titleURL'] = "https://www.quagga.net/"
440
441# the 'buildbotURL' string should point to the location where the buildbot's
442# internal web server (usually the html.WebStatus page) is visible. This
443# typically uses the port number set in the Waterfall 'status' entry, but
444# with an externally-visible host name which the buildbot cannot figure out
445# without some help.
446
447c['buildbotURL'] = "http://buildbot.quagga.net/"
448
449####### DB URL
450
451c['db'] = {
452 # This specifies what database buildbot uses to store its state. You can leave
453 # this at its default for all but the largest installations.
454 'db_url' : "sqlite:///state.sqlite",
455}
456
457#### debug
458c['debugPassword'] = debugPassword