blob: 256123494622a13638513b54cac8cffe1e3b392c [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
82osbuilders = list("build-" + kw for kw in workers)
83
84allbuilders = []
85allbuilders += osbuilders
86allbuilders += analyses_builders
87allbuilders += ["commit-builder"]
88allbuilders += ["build-distcheck"]
89
90# Force merging of requests.
91c['mergeRequests'] = lambda *args, **kwargs: True
92
93####### BUILDSLAVES
94c['slaves'] = []
95
96# The 'slaves' list defines the set of recognized buildslaves. Each element is
97# a BuildSlave object, specifying a unique slave name and password. The same
98# slave name and password must be configured on the slave.
99
100for w in (w for w in workers.values() if ("latent" not in w)
101 or (w["latent"] == False)):
102 c['slaves'].append(buildslave.BuildSlave(w["bot"], w["pass"]))
103
104for w in (w for w in workers.values()
105 if ("latent" in w)
106 and w["latent"]
107 and "hd_image" in w):
108 c['slaves'].append(buildslave.LibVirtSlave(
109 w["bot"],
110 w["pass"],
111 util.Connection(w["session"]),
112 w["hd_image"],
113 ))
114
115# 'protocols' contains information about protocols which master will use for
116# communicating with slaves.
117# You must define at least 'port' option that slaves could connect to your master
118# with this protocol.
119# 'port' must match the value configured into the buildslaves (with their
120# --master option)
121c['protocols'] = {'pb': {'port': 9989}}
122
123####### CHANGESOURCES
124
125# the 'change_source' setting tells the buildmaster how it should find out
126# about source code changes. Here we point to the buildbot clone of pyflakes.
127
128c['change_source'] = []
129c['change_source'].append(changes.GitPoller(
130 quaggagit,
131 workdir='gitpoller-workdir',
132 branches=['master','volatile/next'],
133 pollinterval=300))
134
135####### SCHEDULERS
136
137# Configure the Schedulers, which decide how to react to incoming changes.
138
139# We want a first line of 'quick' builds, which then trigger further builds.
140#
141# A control-flow builder, "commit-builder", used to sequence the 'real'
142# sets of builders, via Triggers.
143
144c['schedulers'] = []
145c['schedulers'].append(schedulers.SingleBranchScheduler(
146 name="master-change",
147 change_filter=util.ChangeFilter(branch='master'),
148 treeStableTimer=10,
149 builderNames=[ "commit-builder" ]))
150
151c['schedulers'].append(schedulers.SingleBranchScheduler(
152 name="next-change",
153 change_filter=util.ChangeFilter(
154 branch='volatile/next'),
155 treeStableTimer=10,
156 builderNames=[ "commit-builder" ] ))
157
158# Initial build checks on faster, non-VM
159c['schedulers'].append(schedulers.Triggerable(
160 name="trigger-build-first",
161 builderNames=list("build-" + kw
162 for kw in workers
163 if workers[kw]["vm"] == False)))
164
165# Build using remaining builders, after firstbuilders.
166c['schedulers'].append(schedulers.Triggerable(
167 name="trigger-build-rest",
168 builderNames=list("build-" + kw
169 for w in workers
170 if workers[kw]["vm"] == True)))
171
172# Analyses tools, e.g. CLang Analyzer scan-build
173c['schedulers'].append(schedulers.Triggerable(
174 name="trigger-build-analyses",
175 builderNames=analyses_builders))
176# Dist check
177c['schedulers'].append(schedulers.Triggerable(
178 name="trigger-distcheck",
179 builderNames=["build-distcheck"]))
180
181# Try and force schedulers
182c['schedulers'].append(schedulers.ForceScheduler(
183 name="force",
184 builderNames=allbuilders))
185
186c['schedulers'].append(schedulers.Try_Userpass(
187 name="try",
188 builderNames=list("build-" + kw
189 for w in workers)
190 + ["build-distcheck",
191 "clang-analyzer" ],
192 userpass=users,
193 port=8031))
194
195####### BUILDERS
196c['builders'] = []
197
198# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
199# what steps, and which slaves can execute them. Note that any particular build will
200# only take place on one slave.
201
202common_steps = [
203steps.Git(repourl=quaggagit, mode='incremental'),
204steps.ShellCommand(command=["./update-autotools"]),
205steps.Configure(),
206steps.ShellCommand(command=["make", "clean"]),
207steps.Compile(),
208]
209
210### Each OS specific builder
211
212factory = util.BuildFactory()
213# check out the source
214factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
215factory.addStep(steps.ShellCommand(command=["./update-autotools"],
216 description="generating autoconf",
217 descriptionDone="autoconf generated"))
218factory.addStep(steps.Configure())
219factory.addStep(steps.ShellCommand(command=["make", "clean"],
220 description="cleaning",
221 descriptionDone="cleaned"))
222factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
223factory.addStep(steps.ShellCommand(command=["make", "check"],
224 description="testing",
225 descriptionDone="tests"))
226
227for kw in workers:
228 c['builders'].append(util.BuilderConfig(
229 name="build-" + kw,
230 slavenames=workers[kw]["bot"],
231 factory=factory))
232
233### distcheck
234factory = util.BuildFactory()
235# check out the source
236factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
237factory.addStep(steps.ShellCommand(command=["./update-autotools"],
238 description="generating autoconf",
239 descriptionDone="autoconf generated"))
240factory.addStep(steps.Configure())
241factory.addStep(steps.ShellCommand(command=["make", "clean"],
242 description="cleaning",
243 descriptionDone="cleaned"))
244factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
245 description="distcheck",
246 descriptionDone="distcheck passes"))
247c['builders'].append(
248 util.BuilderConfig(name="build-distcheck",
249 slavenames=list(w["bot"] for w in workers.values()),
250 factory=factory,
251))
252
253### LLVM clang-analyzer build
254
255f = util.BuildFactory()
256# check out the source
257f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
258 getDescription=True))
259f.addStep(steps.ShellCommand(command=["./update-autotools"],
260 description="autotools",
261 descriptionDone="autoconf generated"))
262f.addStep(steps.Configure())
263f.addStep(steps.ShellCommand(command=["make", "clean"],
264 description="cleaning",
265 descriptionDone="cleaned"))
266
267f.addStep(steps.SetProperty(property="clang-id",
268 value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
269
270f.addStep(steps.SetProperty(property="clang-output-dir",
271 value=util.Interpolate("../CLANG-%(prop:clang-id)s")))
272f.addStep(steps.SetProperty(property="clang-uri",
273 value=util.Interpolate("/clang-analyzer/%(prop:clang-id)s")))
274# relative to buildbot master working directory
275f.addStep(steps.SetProperty(property="clang-upload-dir",
276 value=util.Interpolate("public_html/clang-analyzer/%(prop:clang-id)s")))
277
278f.addStep(steps.Compile(command=["scan-build",
279 "-analyze-headers",
280 "-o",
281 util.Interpolate("%(prop:clang-output-dir)s"),
282 "make", "-j", "all"]))
283f.addStep(steps.DirectoryUpload(
284 slavesrc=util.Interpolate("%(prop:clang-output-dir)s"),
285 masterdest = util.Interpolate("%(prop:clang-upload-dir)s"),
286 compress = 'bz2',
287 name = "clang report",
288 url = util.Interpolate("%(prop:clang-uri)s"),
289))
290f.addStep(steps.RemoveDirectory(
291 dir=util.Interpolate("%(prop:clang-output-dir)s")
292))
293
294c['builders'].append(
295 util.BuilderConfig(name="clang-analyzer",
296 slavenames=list(w["bot"] for w in workers.values() if not w["vm"]),
297 factory=f))
298
299## Co-ordination builds used to sequence parallel builds via Triggerable
300f = util.BuildFactory()
301f.addStep(steps.Trigger (
302 schedulerNames = [ "trigger-build-first" ],
303 waitForFinish=True
304))
305f.addStep(steps.Trigger (
306 schedulerNames = [ "trigger-build-rest" ],
307 waitForFinish=True
308))
309f.addStep(steps.Trigger (
310 schedulerNames = [ "trigger-build-analyses", "trigger-distcheck" ],
311 waitForFinish=True
312))
313
314c['builders'].append(
315 util.BuilderConfig(name="commit-builder",
316 slavenames=["buildbot-fedora-24"],
317 factory=f
318))
319
320####### STATUS TARGETS
321
322# 'status' is a list of Status Targets. The results of each build will be
323# pushed to these targets. buildbot/status/*.py has a variety to choose from,
324# including web pages, email senders, and IRC bots.
325
326c['status'] = []
327
328from buildbot.status import html
329from buildbot.status.web import authz, auth
330
331authz_cfg=authz.Authz(
332 # change any of these to True to enable; see the manual for more
333 # options
334 #auth=auth.BasicAuth([("pyflakes","pyflakes")]),
335 auth=util.BasicAuth(users),
336 gracefulShutdown = False,
337 forceBuild = 'auth', # use this to test your slave once it is set up
338 forceAllBuilds = 'auth', # ..or this
339 pingBuilder = 'auth',
340 stopBuild = 'auth',
341 stopAllBuilds = 'auth',
342 cancelPendingBuild = 'auth',
343 cancelAllPendingBuilds = 'auth',
344 pauseSlave = 'auth',
345)
346c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
347
348c['status'].append(status.MailNotifier(
349 fromaddr="buildbot@quagga.net",
350 extraRecipients=["paul@jakma.org"],
351 sendToInterestedUsers=False,
352))
353
354c['status'].append (status.IRC(
355 "irc.freenode.net", "bb-quagga",
356 useColors=True,
357 channels=[{"channel": "#quagga"}],
358 notify_events={
359 'exception': 1,
360 'successToFailure': 1,
361 'failureToSuccess': 1,
362 },
363))
364
365####### PROJECT IDENTITY
366
367# the 'title' string will appear at the top of this buildbot
368# installation's html.WebStatus home page (linked to the
369# 'titleURL') and is embedded in the title of the waterfall HTML page.
370
371c['title'] = "Quagga"
372c['titleURL'] = "https://www.quagga.net/"
373
374# the 'buildbotURL' string should point to the location where the buildbot's
375# internal web server (usually the html.WebStatus page) is visible. This
376# typically uses the port number set in the Waterfall 'status' entry, but
377# with an externally-visible host name which the buildbot cannot figure out
378# without some help.
379
380c['buildbotURL'] = "http://buildbot.quagga.net/"
381
382####### DB URL
383
384c['db'] = {
385 # This specifies what database buildbot uses to store its state. You can leave
386 # this at its default for all but the largest installations.
387 'db_url' : "sqlite:///state.sqlite",
388}
389
390#### debug
391c['debugPassword'] = debugPassword