blob: 0580c3789c520a9e746814a5a01fef4d37ca63b2 [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
148####### SCHEDULERS
149
150# Configure the Schedulers, which decide how to react to incoming changes.
151
152# We want a first line of 'quick' builds, which then trigger further builds.
153#
154# A control-flow builder, "commit-builder", used to sequence the 'real'
155# sets of builders, via Triggers.
156
157c['schedulers'] = []
158c['schedulers'].append(schedulers.SingleBranchScheduler(
159 name="master-change",
160 change_filter=util.ChangeFilter(branch='master'),
161 treeStableTimer=10,
162 builderNames=[ "commit-builder" ]))
163
164c['schedulers'].append(schedulers.SingleBranchScheduler(
165 name="next-change",
166 change_filter=util.ChangeFilter(
167 branch='volatile/next'),
168 treeStableTimer=10,
169 builderNames=[ "commit-builder" ] ))
170
171# Initial build checks on faster, non-VM
172c['schedulers'].append(schedulers.Triggerable(
173 name="trigger-build-first",
Paul Jakma0d917792017-03-05 14:53:59 +0000174 builderNames=osfastbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000175
176# Build using remaining builders, after firstbuilders.
177c['schedulers'].append(schedulers.Triggerable(
178 name="trigger-build-rest",
Paul Jakma0d917792017-03-05 14:53:59 +0000179 builderNames=osslowbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000180
181# Analyses tools, e.g. CLang Analyzer scan-build
182c['schedulers'].append(schedulers.Triggerable(
183 name="trigger-build-analyses",
184 builderNames=analyses_builders))
185# Dist check
186c['schedulers'].append(schedulers.Triggerable(
187 name="trigger-distcheck",
188 builderNames=["build-distcheck"]))
Paul Jakma390bffa2017-03-05 14:27:11 +0000189# RPM check and build
190c['schedulers'].append(schedulers.Triggerable(
191 name="trigger-rpm",
Paul Jakma0d917792017-03-05 14:53:59 +0000192 builderNames=rpmbuilders))
Paul Jakma08815d52017-03-04 14:30:44 +0000193
194# Try and force schedulers
195c['schedulers'].append(schedulers.ForceScheduler(
196 name="force",
197 builderNames=allbuilders))
198
199c['schedulers'].append(schedulers.Try_Userpass(
200 name="try",
Paul Jakma0d917792017-03-05 14:53:59 +0000201 builderNames=osbuilders
202 + rpmbuilders
203 + ["build-distcheck",
Paul Jakma08815d52017-03-04 14:30:44 +0000204 "clang-analyzer" ],
205 userpass=users,
206 port=8031))
207
208####### BUILDERS
209c['builders'] = []
210
211# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
212# what steps, and which slaves can execute them. Note that any particular build will
213# only take place on one slave.
214
215common_steps = [
216steps.Git(repourl=quaggagit, mode='incremental'),
217steps.ShellCommand(command=["./update-autotools"]),
218steps.Configure(),
219steps.ShellCommand(command=["make", "clean"]),
220steps.Compile(),
221]
222
Paul Jakma390bffa2017-03-05 14:27:11 +0000223### Default 'check' build, builder instantiated for each OS
Paul Jakma08815d52017-03-04 14:30:44 +0000224
225factory = util.BuildFactory()
226# check out the source
227factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
228factory.addStep(steps.ShellCommand(command=["./update-autotools"],
229 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000230 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000231factory.addStep(steps.Configure())
232factory.addStep(steps.ShellCommand(command=["make", "clean"],
233 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000234 descriptionDone="clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000235factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
236factory.addStep(steps.ShellCommand(command=["make", "check"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000237 description="checking",
238 descriptionDone="make check"))
Paul Jakma08815d52017-03-04 14:30:44 +0000239
Paul Jakma390bffa2017-03-05 14:27:11 +0000240# create builder for every OS, for every buildbot
241# XXX: at moment this assumes 1:1 OS<->bot
Paul Jakma08815d52017-03-04 14:30:44 +0000242for kw in workers:
243 c['builders'].append(util.BuilderConfig(
244 name="build-" + kw,
245 slavenames=workers[kw]["bot"],
246 factory=factory))
247
Paul Jakma390bffa2017-03-05 14:27:11 +0000248### distcheck Builder, executed on any available bot
Paul Jakma08815d52017-03-04 14:30:44 +0000249factory = util.BuildFactory()
250# check out the source
251factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
252factory.addStep(steps.ShellCommand(command=["./update-autotools"],
253 description="generating autoconf",
Paul Jakma390bffa2017-03-05 14:27:11 +0000254 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000255factory.addStep(steps.Configure())
256factory.addStep(steps.ShellCommand(command=["make", "clean"],
257 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000258 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000259factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000260 description="run make distcheck",
261 descriptionDone="make distcheck"))
Paul Jakma08815d52017-03-04 14:30:44 +0000262c['builders'].append(
263 util.BuilderConfig(name="build-distcheck",
264 slavenames=list(w["bot"] for w in workers.values()),
265 factory=factory,
266))
267
Paul Jakma390bffa2017-03-05 14:27:11 +0000268### LLVM clang-analyzer build, executed on any available non-VM bot
Paul Jakma08815d52017-03-04 14:30:44 +0000269
270f = util.BuildFactory()
271# check out the source
272f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
273 getDescription=True))
274f.addStep(steps.ShellCommand(command=["./update-autotools"],
Paul Jakma390bffa2017-03-05 14:27:11 +0000275 description="run autotools",
276 descriptionDone="autoconf"))
Paul Jakma08815d52017-03-04 14:30:44 +0000277f.addStep(steps.Configure())
278f.addStep(steps.ShellCommand(command=["make", "clean"],
279 description="cleaning",
Paul Jakma390bffa2017-03-05 14:27:11 +0000280 descriptionDone="make clean"))
Paul Jakma08815d52017-03-04 14:30:44 +0000281
282f.addStep(steps.SetProperty(property="clang-id",
283 value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
284
285f.addStep(steps.SetProperty(property="clang-output-dir",
286 value=util.Interpolate("../CLANG-%(prop:clang-id)s")))
287f.addStep(steps.SetProperty(property="clang-uri",
288 value=util.Interpolate("/clang-analyzer/%(prop:clang-id)s")))
289# relative to buildbot master working directory
290f.addStep(steps.SetProperty(property="clang-upload-dir",
291 value=util.Interpolate("public_html/clang-analyzer/%(prop:clang-id)s")))
292
293f.addStep(steps.Compile(command=["scan-build",
294 "-analyze-headers",
295 "-o",
296 util.Interpolate("%(prop:clang-output-dir)s"),
297 "make", "-j", "all"]))
298f.addStep(steps.DirectoryUpload(
299 slavesrc=util.Interpolate("%(prop:clang-output-dir)s"),
300 masterdest = util.Interpolate("%(prop:clang-upload-dir)s"),
301 compress = 'bz2',
302 name = "clang report",
303 url = util.Interpolate("%(prop:clang-uri)s"),
304))
305f.addStep(steps.RemoveDirectory(
306 dir=util.Interpolate("%(prop:clang-output-dir)s")
307))
308
Paul Jakma390bffa2017-03-05 14:27:11 +0000309
Paul Jakma08815d52017-03-04 14:30:44 +0000310c['builders'].append(
311 util.BuilderConfig(name="clang-analyzer",
312 slavenames=list(w["bot"] for w in workers.values() if not w["vm"]),
313 factory=f))
314
Paul Jakma390bffa2017-03-05 14:27:11 +0000315
316### RPM: check and build
317f = util.BuildFactory ()
318
319# check out the source
320f.addStep(steps.Git(repourl=quaggagit, mode='full'))
321f.addStep(steps.ShellCommand(command=["./update-autotools"],
322 description="run autotools",
323 descriptionDone="autotools"))
324f.addStep(steps.Configure())
325f.addStep(steps.ShellCommand(command=["make", "dist"],
326 description="run make dist",
327 descriptionDone="make dist"))
328# not imported somehow
329#f.addStep(steps.RpmLint(fileloc="redhat/quagga.spec"))
330f.addStep(steps.ShellCommand(command=["rpmlint", "-i", "redhat/quagga.spec"],
331 description="run rpmlint",
332 descriptionDone="rpmlint"))
333f.addStep(steps.RpmBuild(specfile="redhat/quagga.spec"))
334# rpmdir=util.Interpolate("%(prop:builddir)s/rpm")))
335
336# XXX: assuming 1:1 OS:buildbot mapping
337for kw in (kw for kw in workers if workers[kw]["pkg"] == "rpm"):
338 c['builders'].append(
339 util.BuilderConfig(name="rpm-" + kw,
340 slavenames="buildbot-" + kw,
341 factory=f
342 )
343 )
344
345### Co-ordination builds used to sequence parallel builds via Triggerable
346
347# to understand this you have to read this list and the Triggered schedulers
348# to see what sets of builds are being sequenced. Bit clunky, but Buildbot
349# doesn't have a way to just specify a pipeline of groups of builders more
350# cleanly.
351
Paul Jakma08815d52017-03-04 14:30:44 +0000352f = util.BuildFactory()
353f.addStep(steps.Trigger (
354 schedulerNames = [ "trigger-build-first" ],
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-rest" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000360 waitForFinish=True,
361 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000362))
363f.addStep(steps.Trigger (
364 schedulerNames = [ "trigger-build-analyses", "trigger-distcheck" ],
Paul Jakma390bffa2017-03-05 14:27:11 +0000365 waitForFinish=True,
366 updateSourceStamp=True
367))
368f.addStep(steps.Trigger (
369 schedulerNames = [ "trigger-rpm" ],
370 waitForFinish=True,
371 updateSourceStamp=True
Paul Jakma08815d52017-03-04 14:30:44 +0000372))
373
374c['builders'].append(
375 util.BuilderConfig(name="commit-builder",
Paul Jakma390bffa2017-03-05 14:27:11 +0000376 slavenames=[w["bot"] for w in workers.values() if not w["vm"]],
377 factory=f)
378)
379
Paul Jakma08815d52017-03-04 14:30:44 +0000380
381####### STATUS TARGETS
382
383# 'status' is a list of Status Targets. The results of each build will be
384# pushed to these targets. buildbot/status/*.py has a variety to choose from,
385# including web pages, email senders, and IRC bots.
386
387c['status'] = []
388
389from buildbot.status import html
390from buildbot.status.web import authz, auth
391
392authz_cfg=authz.Authz(
393 # change any of these to True to enable; see the manual for more
394 # options
395 #auth=auth.BasicAuth([("pyflakes","pyflakes")]),
396 auth=util.BasicAuth(users),
397 gracefulShutdown = False,
398 forceBuild = 'auth', # use this to test your slave once it is set up
399 forceAllBuilds = 'auth', # ..or this
400 pingBuilder = 'auth',
401 stopBuild = 'auth',
402 stopAllBuilds = 'auth',
403 cancelPendingBuild = 'auth',
404 cancelAllPendingBuilds = 'auth',
405 pauseSlave = 'auth',
406)
407c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
408
409c['status'].append(status.MailNotifier(
410 fromaddr="buildbot@quagga.net",
411 extraRecipients=["paul@jakma.org"],
412 sendToInterestedUsers=False,
413))
414
415c['status'].append (status.IRC(
416 "irc.freenode.net", "bb-quagga",
417 useColors=True,
418 channels=[{"channel": "#quagga"}],
419 notify_events={
420 'exception': 1,
421 'successToFailure': 1,
422 'failureToSuccess': 1,
423 },
424))
425
426####### PROJECT IDENTITY
427
428# the 'title' string will appear at the top of this buildbot
429# installation's html.WebStatus home page (linked to the
430# 'titleURL') and is embedded in the title of the waterfall HTML page.
431
432c['title'] = "Quagga"
433c['titleURL'] = "https://www.quagga.net/"
434
435# the 'buildbotURL' string should point to the location where the buildbot's
436# internal web server (usually the html.WebStatus page) is visible. This
437# typically uses the port number set in the Waterfall 'status' entry, but
438# with an externally-visible host name which the buildbot cannot figure out
439# without some help.
440
441c['buildbotURL'] = "http://buildbot.quagga.net/"
442
443####### DB URL
444
445c['db'] = {
446 # This specifies what database buildbot uses to store its state. You can leave
447 # this at its default for all but the largest installations.
448 'db_url' : "sqlite:///state.sqlite",
449}
450
451#### debug
452c['debugPassword'] = debugPassword