blob: 3bb271112782de658b4b82b83867c7d799b82820 [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 Jakma08815d52017-03-04 14:30:44 +000083
84allbuilders = []
85allbuilders += osbuilders
Paul Jakma390bffa2017-03-05 14:27:11 +000086allbuilders += ["rpm-" + kw for kw in workers if workers[kw]["pkg"] == "rpm"]
Paul Jakma08815d52017-03-04 14:30:44 +000087allbuilders += analyses_builders
88allbuilders += ["commit-builder"]
89allbuilders += ["build-distcheck"]
90
91# Force merging of requests.
92c['mergeRequests'] = lambda *args, **kwargs: True
93
94####### BUILDSLAVES
95c['slaves'] = []
96
97# The 'slaves' list defines the set of recognized buildslaves. Each element is
98# a BuildSlave object, specifying a unique slave name and password. The same
99# slave name and password must be configured on the slave.
100
101for w in (w for w in workers.values() if ("latent" not in w)
102 or (w["latent"] == False)):
103 c['slaves'].append(buildslave.BuildSlave(w["bot"], w["pass"]))
104
105for w in (w for w in workers.values()
106 if ("latent" in w)
107 and w["latent"]
108 and "hd_image" in w):
109 c['slaves'].append(buildslave.LibVirtSlave(
110 w["bot"],
111 w["pass"],
112 util.Connection(w["session"]),
113 w["hd_image"],
114 ))
115
116# 'protocols' contains information about protocols which master will use for
117# communicating with slaves.
118# You must define at least 'port' option that slaves could connect to your master
119# with this protocol.
120# 'port' must match the value configured into the buildslaves (with their
121# --master option)
122c['protocols'] = {'pb': {'port': 9989}}
123
124####### CHANGESOURCES
125
126# the 'change_source' setting tells the buildmaster how it should find out
127# about source code changes. Here we point to the buildbot clone of pyflakes.
128
129c['change_source'] = []
130c['change_source'].append(changes.GitPoller(
131 quaggagit,
132 workdir='gitpoller-workdir',
133 branches=['master','volatile/next'],
134 pollinterval=300))
135
136####### SCHEDULERS
137
138# Configure the Schedulers, which decide how to react to incoming changes.
139
140# We want a first line of 'quick' builds, which then trigger further builds.
141#
142# A control-flow builder, "commit-builder", used to sequence the 'real'
143# sets of builders, via Triggers.
144
145c['schedulers'] = []
146c['schedulers'].append(schedulers.SingleBranchScheduler(
147 name="master-change",
148 change_filter=util.ChangeFilter(branch='master'),
149 treeStableTimer=10,
150 builderNames=[ "commit-builder" ]))
151
152c['schedulers'].append(schedulers.SingleBranchScheduler(
153 name="next-change",
154 change_filter=util.ChangeFilter(
155 branch='volatile/next'),
156 treeStableTimer=10,
157 builderNames=[ "commit-builder" ] ))
158
159# Initial build checks on faster, non-VM
160c['schedulers'].append(schedulers.Triggerable(
161 name="trigger-build-first",
162 builderNames=list("build-" + kw
163 for kw in workers
164 if workers[kw]["vm"] == False)))
165
166# Build using remaining builders, after firstbuilders.
167c['schedulers'].append(schedulers.Triggerable(
168 name="trigger-build-rest",
169 builderNames=list("build-" + kw
170 for w in workers
171 if workers[kw]["vm"] == True)))
172
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",
184 builderNames=["rpm-" + kw
185 for kw in workers
186 if workers[kw]["pkg"] == "rpm"]))
Paul Jakma08815d52017-03-04 14:30:44 +0000187
188# Try and force schedulers
189c['schedulers'].append(schedulers.ForceScheduler(
190 name="force",
191 builderNames=allbuilders))
192
193c['schedulers'].append(schedulers.Try_Userpass(
194 name="try",
Paul Jakma390bffa2017-03-05 14:27:11 +0000195 builderNames=["build-" + kw for kw in workers]
196 + ["rpm-" + kw for kw in workers
197 if workers[kw]["pkg"] == "rpm"]
Paul Jakma08815d52017-03-04 14:30:44 +0000198 + ["build-distcheck",
199 "clang-analyzer" ],
200 userpass=users,
201 port=8031))
202
203####### BUILDERS
204c['builders'] = []
205
206# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
207# what steps, and which slaves can execute them. Note that any particular build will
208# only take place on one slave.
209
210common_steps = [
211steps.Git(repourl=quaggagit, mode='incremental'),
212steps.ShellCommand(command=["./update-autotools"]),
213steps.Configure(),
214steps.ShellCommand(command=["make", "clean"]),
215steps.Compile(),
216]
217
Paul Jakma390bffa2017-03-05 14:27:11 +0000218### Default 'check' build, builder instantiated for each OS
Paul Jakma08815d52017-03-04 14:30:44 +0000219
220factory = util.BuildFactory()
221# check out the source
222factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
223factory.addStep(steps.ShellCommand(command=["./update-autotools"],
224 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000225 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000226factory.addStep(steps.Configure())
227factory.addStep(steps.ShellCommand(command=["make", "clean"],
228 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000229 descriptionDone="clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000230factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
231factory.addStep(steps.ShellCommand(command=["make", "check"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000232 description="checking",
233 descriptionDone="make check"))
Paul Jakma08815d52017-03-04 14:30:44 +0000234
Paul Jakma390bffa2017-03-05 14:27:11 +0000235# create builder for every OS, for every buildbot
236# XXX: at moment this assumes 1:1 OS<->bot
Paul Jakma08815d52017-03-04 14:30:44 +0000237for kw in workers:
238 c['builders'].append(util.BuilderConfig(
239 name="build-" + kw,
240 slavenames=workers[kw]["bot"],
241 factory=factory))
242
Paul Jakma390bffa2017-03-05 14:27:11 +0000243### distcheck Builder, executed on any available bot
Paul Jakma08815d52017-03-04 14:30:44 +0000244factory = util.BuildFactory()
245# check out the source
246factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
247factory.addStep(steps.ShellCommand(command=["./update-autotools"],
248 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000249 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000250factory.addStep(steps.Configure())
251factory.addStep(steps.ShellCommand(command=["make", "clean"],
252 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000253 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000254factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000255 description="run make distcheck",
256 descriptionDone="make distcheck"))
Paul Jakma08815d52017-03-04 14:30:44 +0000257c['builders'].append(
258 util.BuilderConfig(name="build-distcheck",
259 slavenames=list(w["bot"] for w in workers.values()),
260 factory=factory,
261))
262
Paul Jakma390bffa2017-03-05 14:27:11 +0000263### LLVM clang-analyzer build, executed on any available non-VM bot
Paul Jakma08815d52017-03-04 14:30:44 +0000264
265f = util.BuildFactory()
266# check out the source
267f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
268 getDescription=True))
269f.addStep(steps.ShellCommand(command=["./update-autotools"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000270 description="run autotools",
271 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000272f.addStep(steps.Configure())
273f.addStep(steps.ShellCommand(command=["make", "clean"],
274 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000275 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000276
277f.addStep(steps.SetProperty(property="clang-id",
278 value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
279
280f.addStep(steps.SetProperty(property="clang-output-dir",
281 value=util.Interpolate("../CLANG-%(prop:clang-id)s")))
282f.addStep(steps.SetProperty(property="clang-uri",
283 value=util.Interpolate("/clang-analyzer/%(prop:clang-id)s")))
284# relative to buildbot master working directory
285f.addStep(steps.SetProperty(property="clang-upload-dir",
286 value=util.Interpolate("public_html/clang-analyzer/%(prop:clang-id)s")))
287
288f.addStep(steps.Compile(command=["scan-build",
289 "-analyze-headers",
290 "-o",
291 util.Interpolate("%(prop:clang-output-dir)s"),
292 "make", "-j", "all"]))
293f.addStep(steps.DirectoryUpload(
294 slavesrc=util.Interpolate("%(prop:clang-output-dir)s"),
295 masterdest = util.Interpolate("%(prop:clang-upload-dir)s"),
296 compress = 'bz2',
297 name = "clang report",
298 url = util.Interpolate("%(prop:clang-uri)s"),
299))
300f.addStep(steps.RemoveDirectory(
301 dir=util.Interpolate("%(prop:clang-output-dir)s")
302))
303
Paul Jakma390bffa2017-03-05 14:27:11 +0000304
Paul Jakma08815d52017-03-04 14:30:44 +0000305c['builders'].append(
306 util.BuilderConfig(name="clang-analyzer",
307 slavenames=list(w["bot"] for w in workers.values() if not w["vm"]),
308 factory=f))
309
Paul Jakma390bffa2017-03-05 14:27:11 +0000310
311### RPM: check and build
312f = util.BuildFactory ()
313
314# check out the source
315f.addStep(steps.Git(repourl=quaggagit, mode='full'))
316f.addStep(steps.ShellCommand(command=["./update-autotools"],
317 description="run autotools",
318 descriptionDone="autotools"))
319f.addStep(steps.Configure())
320f.addStep(steps.ShellCommand(command=["make", "dist"],
321 description="run make dist",
322 descriptionDone="make dist"))
323# not imported somehow
324#f.addStep(steps.RpmLint(fileloc="redhat/quagga.spec"))
325f.addStep(steps.ShellCommand(command=["rpmlint", "-i", "redhat/quagga.spec"],
326 description="run rpmlint",
327 descriptionDone="rpmlint"))
328f.addStep(steps.RpmBuild(specfile="redhat/quagga.spec"))
329# rpmdir=util.Interpolate("%(prop:builddir)s/rpm")))
330
331# XXX: assuming 1:1 OS:buildbot mapping
332for kw in (kw for kw in workers if workers[kw]["pkg"] == "rpm"):
333 c['builders'].append(
334 util.BuilderConfig(name="rpm-" + kw,
335 slavenames="buildbot-" + kw,
336 factory=f
337 )
338 )
339
340### Co-ordination builds used to sequence parallel builds via Triggerable
341
342# to understand this you have to read this list and the Triggered schedulers
343# to see what sets of builds are being sequenced. Bit clunky, but Buildbot
344# doesn't have a way to just specify a pipeline of groups of builders more
345# cleanly.
346
Paul Jakma08815d52017-03-04 14:30:44 +0000347f = util.BuildFactory()
348f.addStep(steps.Trigger (
349 schedulerNames = [ "trigger-build-first" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000350 waitForFinish=True,
351 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000352))
353f.addStep(steps.Trigger (
354 schedulerNames = [ "trigger-build-rest" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000355 waitForFinish=True,
356 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000357))
358f.addStep(steps.Trigger (
359 schedulerNames = [ "trigger-build-analyses", "trigger-distcheck" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000360 waitForFinish=True,
361 updateSourceStamp=True
362))
363f.addStep(steps.Trigger (
364 schedulerNames = [ "trigger-rpm" ],
365 waitForFinish=True,
366 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000367))
368
369c['builders'].append(
370 util.BuilderConfig(name="commit-builder",
Paul Jakma390bffa2017-03-05 14:27:11 +0000371 slavenames=[w["bot"] for w in workers.values() if not w["vm"]],
372 factory=f)
373)
374
Paul Jakma08815d52017-03-04 14:30:44 +0000375
376####### STATUS TARGETS
377
378# 'status' is a list of Status Targets. The results of each build will be
379# pushed to these targets. buildbot/status/*.py has a variety to choose from,
380# including web pages, email senders, and IRC bots.
381
382c['status'] = []
383
384from buildbot.status import html
385from buildbot.status.web import authz, auth
386
387authz_cfg=authz.Authz(
388 # change any of these to True to enable; see the manual for more
389 # options
390 #auth=auth.BasicAuth([("pyflakes","pyflakes")]),
391 auth=util.BasicAuth(users),
392 gracefulShutdown = False,
393 forceBuild = 'auth', # use this to test your slave once it is set up
394 forceAllBuilds = 'auth', # ..or this
395 pingBuilder = 'auth',
396 stopBuild = 'auth',
397 stopAllBuilds = 'auth',
398 cancelPendingBuild = 'auth',
399 cancelAllPendingBuilds = 'auth',
400 pauseSlave = 'auth',
401)
402c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
403
404c['status'].append(status.MailNotifier(
405 fromaddr="buildbot@quagga.net",
406 extraRecipients=["paul@jakma.org"],
407 sendToInterestedUsers=False,
408))
409
410c['status'].append (status.IRC(
411 "irc.freenode.net", "bb-quagga",
412 useColors=True,
413 channels=[{"channel": "#quagga"}],
414 notify_events={
415 'exception': 1,
416 'successToFailure': 1,
417 'failureToSuccess': 1,
418 },
419))
420
421####### PROJECT IDENTITY
422
423# the 'title' string will appear at the top of this buildbot
424# installation's html.WebStatus home page (linked to the
425# 'titleURL') and is embedded in the title of the waterfall HTML page.
426
427c['title'] = "Quagga"
428c['titleURL'] = "https://www.quagga.net/"
429
430# the 'buildbotURL' string should point to the location where the buildbot's
431# internal web server (usually the html.WebStatus page) is visible. This
432# typically uses the port number set in the Waterfall 'status' entry, but
433# with an externally-visible host name which the buildbot cannot figure out
434# without some help.
435
436c['buildbotURL'] = "http://buildbot.quagga.net/"
437
438####### DB URL
439
440c['db'] = {
441 # This specifies what database buildbot uses to store its state. You can leave
442 # this at its default for all but the largest installations.
443 'db_url' : "sqlite:///state.sqlite",
444}
445
446#### debug
447c['debugPassword'] = debugPassword