master.cfg 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. # -*- python -*-
  2. # ex: set syntax=python:
  3. from buildbot.plugins import *
  4. from buildbot.plugins import buildslave, util
  5. # This is a sample buildmaster config file. It must be installed as
  6. # 'master.cfg' in your buildmaster's base directory.
  7. # This is the dictionary that the buildmaster pays attention to. We also use
  8. # a shorter alias to save typing.
  9. c = BuildmasterConfig = {}
  10. quaggagit = 'git://git.sv.gnu.org/quagga.git'
  11. # password defs
  12. execfile("pass.cfg")
  13. workers = {
  14. "fedora-24": {
  15. "os": "Fedora",
  16. "version": "24",
  17. "vm": False,
  18. "pkg": "rpm",
  19. },
  20. "centos-7": {
  21. "os": "CentOS",
  22. "version": "7",
  23. "vm": False,
  24. "pkg": "rpm",
  25. },
  26. "debian-8": {
  27. "os": "Debian",
  28. "version": "8",
  29. "vm": True,
  30. "pkg": "dpkg",
  31. "latent": True,
  32. "hd_image": "/var/lib/libvirt/images/debian8.qcow2",
  33. },
  34. "debian-9": {
  35. "os": "Debian",
  36. "version": "9",
  37. "vm": True,
  38. "pkg": "dpkg",
  39. "latent": True,
  40. "hd_image": "/var/lib/libvirt/images/debian9.qcow2",
  41. },
  42. "freebsd-10": {
  43. "os": "FreeBSD",
  44. "version": "10",
  45. "vm": True,
  46. "pkg": "",
  47. "latent": True,
  48. "hd_image": "/var/lib/libvirt/images/freebsd103.qcow2",
  49. },
  50. "freebsd-11": {
  51. "os": "FreeBSD",
  52. "version": "11",
  53. "vm": True,
  54. "pkg": "",
  55. "latent": True,
  56. "hd_image": "/var/lib/libvirt/images/freebsd110.qcow2",
  57. },
  58. }
  59. # ensure "latent" is set to false, where not set.
  60. # add in the passwords
  61. for kw in workers:
  62. w = workers[kw]
  63. w["bot"] = "buildbot-" + kw
  64. if "latent" not in w:
  65. w["latent"] = False
  66. w["pass"] = workers_pass[kw]
  67. analyses_builders = [ "clang-analyzer" ]
  68. # default Libvirt session
  69. for w in (w for w in workers.values () if ("latent" in w)
  70. and ("session" not in w)):
  71. w["session"] = 'qemu+ssh://buildbot@sagan.jakma.org/system'
  72. osbuilders = list("build-" + kw for kw in workers)
  73. allbuilders = []
  74. allbuilders += osbuilders
  75. allbuilders += analyses_builders
  76. allbuilders += ["commit-builder"]
  77. allbuilders += ["build-distcheck"]
  78. # Force merging of requests.
  79. c['mergeRequests'] = lambda *args, **kwargs: True
  80. ####### BUILDSLAVES
  81. c['slaves'] = []
  82. # The 'slaves' list defines the set of recognized buildslaves. Each element is
  83. # a BuildSlave object, specifying a unique slave name and password. The same
  84. # slave name and password must be configured on the slave.
  85. for w in (w for w in workers.values() if ("latent" not in w)
  86. or (w["latent"] == False)):
  87. c['slaves'].append(buildslave.BuildSlave(w["bot"], w["pass"]))
  88. for w in (w for w in workers.values()
  89. if ("latent" in w)
  90. and w["latent"]
  91. and "hd_image" in w):
  92. c['slaves'].append(buildslave.LibVirtSlave(
  93. w["bot"],
  94. w["pass"],
  95. util.Connection(w["session"]),
  96. w["hd_image"],
  97. ))
  98. # 'protocols' contains information about protocols which master will use for
  99. # communicating with slaves.
  100. # You must define at least 'port' option that slaves could connect to your master
  101. # with this protocol.
  102. # 'port' must match the value configured into the buildslaves (with their
  103. # --master option)
  104. c['protocols'] = {'pb': {'port': 9989}}
  105. ####### CHANGESOURCES
  106. # the 'change_source' setting tells the buildmaster how it should find out
  107. # about source code changes. Here we point to the buildbot clone of pyflakes.
  108. c['change_source'] = []
  109. c['change_source'].append(changes.GitPoller(
  110. quaggagit,
  111. workdir='gitpoller-workdir',
  112. branches=['master','volatile/next'],
  113. pollinterval=300))
  114. ####### SCHEDULERS
  115. # Configure the Schedulers, which decide how to react to incoming changes.
  116. # We want a first line of 'quick' builds, which then trigger further builds.
  117. #
  118. # A control-flow builder, "commit-builder", used to sequence the 'real'
  119. # sets of builders, via Triggers.
  120. c['schedulers'] = []
  121. c['schedulers'].append(schedulers.SingleBranchScheduler(
  122. name="master-change",
  123. change_filter=util.ChangeFilter(branch='master'),
  124. treeStableTimer=10,
  125. builderNames=[ "commit-builder" ]))
  126. c['schedulers'].append(schedulers.SingleBranchScheduler(
  127. name="next-change",
  128. change_filter=util.ChangeFilter(
  129. branch='volatile/next'),
  130. treeStableTimer=10,
  131. builderNames=[ "commit-builder" ] ))
  132. # Initial build checks on faster, non-VM
  133. c['schedulers'].append(schedulers.Triggerable(
  134. name="trigger-build-first",
  135. builderNames=list("build-" + kw
  136. for kw in workers
  137. if workers[kw]["vm"] == False)))
  138. # Build using remaining builders, after firstbuilders.
  139. c['schedulers'].append(schedulers.Triggerable(
  140. name="trigger-build-rest",
  141. builderNames=list("build-" + kw
  142. for w in workers
  143. if workers[kw]["vm"] == True)))
  144. # Analyses tools, e.g. CLang Analyzer scan-build
  145. c['schedulers'].append(schedulers.Triggerable(
  146. name="trigger-build-analyses",
  147. builderNames=analyses_builders))
  148. # Dist check
  149. c['schedulers'].append(schedulers.Triggerable(
  150. name="trigger-distcheck",
  151. builderNames=["build-distcheck"]))
  152. # Try and force schedulers
  153. c['schedulers'].append(schedulers.ForceScheduler(
  154. name="force",
  155. builderNames=allbuilders))
  156. c['schedulers'].append(schedulers.Try_Userpass(
  157. name="try",
  158. builderNames=list("build-" + kw
  159. for w in workers)
  160. + ["build-distcheck",
  161. "clang-analyzer" ],
  162. userpass=users,
  163. port=8031))
  164. ####### BUILDERS
  165. c['builders'] = []
  166. # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
  167. # what steps, and which slaves can execute them. Note that any particular build will
  168. # only take place on one slave.
  169. common_steps = [
  170. steps.Git(repourl=quaggagit, mode='incremental'),
  171. steps.ShellCommand(command=["./update-autotools"]),
  172. steps.Configure(),
  173. steps.ShellCommand(command=["make", "clean"]),
  174. steps.Compile(),
  175. ]
  176. ### Each OS specific builder
  177. factory = util.BuildFactory()
  178. # check out the source
  179. factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
  180. factory.addStep(steps.ShellCommand(command=["./update-autotools"],
  181. description="generating autoconf",
  182. descriptionDone="autoconf generated"))
  183. factory.addStep(steps.Configure())
  184. factory.addStep(steps.ShellCommand(command=["make", "clean"],
  185. description="cleaning",
  186. descriptionDone="cleaned"))
  187. factory.addStep(steps.Compile(command=["make", "-j", "2", "all"]))
  188. factory.addStep(steps.ShellCommand(command=["make", "check"],
  189. description="testing",
  190. descriptionDone="tests"))
  191. for kw in workers:
  192. c['builders'].append(util.BuilderConfig(
  193. name="build-" + kw,
  194. slavenames=workers[kw]["bot"],
  195. factory=factory))
  196. ### distcheck
  197. factory = util.BuildFactory()
  198. # check out the source
  199. factory.addStep(steps.Git(repourl=quaggagit, mode='incremental'))
  200. factory.addStep(steps.ShellCommand(command=["./update-autotools"],
  201. description="generating autoconf",
  202. descriptionDone="autoconf generated"))
  203. factory.addStep(steps.Configure())
  204. factory.addStep(steps.ShellCommand(command=["make", "clean"],
  205. description="cleaning",
  206. descriptionDone="cleaned"))
  207. factory.addStep(steps.ShellCommand(command=["make", "distcheck"],
  208. description="distcheck",
  209. descriptionDone="distcheck passes"))
  210. c['builders'].append(
  211. util.BuilderConfig(name="build-distcheck",
  212. slavenames=list(w["bot"] for w in workers.values()),
  213. factory=factory,
  214. ))
  215. ### LLVM clang-analyzer build
  216. f = util.BuildFactory()
  217. # check out the source
  218. f.addStep(steps.Git(repourl=quaggagit, mode='incremental',
  219. getDescription=True))
  220. f.addStep(steps.ShellCommand(command=["./update-autotools"],
  221. description="autotools",
  222. descriptionDone="autoconf generated"))
  223. f.addStep(steps.Configure())
  224. f.addStep(steps.ShellCommand(command=["make", "clean"],
  225. description="cleaning",
  226. descriptionDone="cleaned"))
  227. f.addStep(steps.SetProperty(property="clang-id",
  228. value=util.Interpolate("%(prop:commit-description)s-%(prop:buildnumber)s")))
  229. f.addStep(steps.SetProperty(property="clang-output-dir",
  230. value=util.Interpolate("../CLANG-%(prop:clang-id)s")))
  231. f.addStep(steps.SetProperty(property="clang-uri",
  232. value=util.Interpolate("/clang-analyzer/%(prop:clang-id)s")))
  233. # relative to buildbot master working directory
  234. f.addStep(steps.SetProperty(property="clang-upload-dir",
  235. value=util.Interpolate("public_html/clang-analyzer/%(prop:clang-id)s")))
  236. f.addStep(steps.Compile(command=["scan-build",
  237. "-analyze-headers",
  238. "-o",
  239. util.Interpolate("%(prop:clang-output-dir)s"),
  240. "make", "-j", "all"]))
  241. f.addStep(steps.DirectoryUpload(
  242. slavesrc=util.Interpolate("%(prop:clang-output-dir)s"),
  243. masterdest = util.Interpolate("%(prop:clang-upload-dir)s"),
  244. compress = 'bz2',
  245. name = "clang report",
  246. url = util.Interpolate("%(prop:clang-uri)s"),
  247. ))
  248. f.addStep(steps.RemoveDirectory(
  249. dir=util.Interpolate("%(prop:clang-output-dir)s")
  250. ))
  251. c['builders'].append(
  252. util.BuilderConfig(name="clang-analyzer",
  253. slavenames=list(w["bot"] for w in workers.values() if not w["vm"]),
  254. factory=f))
  255. ## Co-ordination builds used to sequence parallel builds via Triggerable
  256. f = util.BuildFactory()
  257. f.addStep(steps.Trigger (
  258. schedulerNames = [ "trigger-build-first" ],
  259. waitForFinish=True
  260. ))
  261. f.addStep(steps.Trigger (
  262. schedulerNames = [ "trigger-build-rest" ],
  263. waitForFinish=True
  264. ))
  265. f.addStep(steps.Trigger (
  266. schedulerNames = [ "trigger-build-analyses", "trigger-distcheck" ],
  267. waitForFinish=True
  268. ))
  269. c['builders'].append(
  270. util.BuilderConfig(name="commit-builder",
  271. slavenames=["buildbot-fedora-24"],
  272. factory=f
  273. ))
  274. ####### STATUS TARGETS
  275. # 'status' is a list of Status Targets. The results of each build will be
  276. # pushed to these targets. buildbot/status/*.py has a variety to choose from,
  277. # including web pages, email senders, and IRC bots.
  278. c['status'] = []
  279. from buildbot.status import html
  280. from buildbot.status.web import authz, auth
  281. authz_cfg=authz.Authz(
  282. # change any of these to True to enable; see the manual for more
  283. # options
  284. #auth=auth.BasicAuth([("pyflakes","pyflakes")]),
  285. auth=util.BasicAuth(users),
  286. gracefulShutdown = False,
  287. forceBuild = 'auth', # use this to test your slave once it is set up
  288. forceAllBuilds = 'auth', # ..or this
  289. pingBuilder = 'auth',
  290. stopBuild = 'auth',
  291. stopAllBuilds = 'auth',
  292. cancelPendingBuild = 'auth',
  293. cancelAllPendingBuilds = 'auth',
  294. pauseSlave = 'auth',
  295. )
  296. c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
  297. c['status'].append(status.MailNotifier(
  298. fromaddr="buildbot@quagga.net",
  299. extraRecipients=["paul@jakma.org"],
  300. sendToInterestedUsers=False,
  301. ))
  302. c['status'].append (status.IRC(
  303. "irc.freenode.net", "bb-quagga",
  304. useColors=True,
  305. channels=[{"channel": "#quagga"}],
  306. notify_events={
  307. 'exception': 1,
  308. 'successToFailure': 1,
  309. 'failureToSuccess': 1,
  310. },
  311. ))
  312. ####### PROJECT IDENTITY
  313. # the 'title' string will appear at the top of this buildbot
  314. # installation's html.WebStatus home page (linked to the
  315. # 'titleURL') and is embedded in the title of the waterfall HTML page.
  316. c['title'] = "Quagga"
  317. c['titleURL'] = "https://www.quagga.net/"
  318. # the 'buildbotURL' string should point to the location where the buildbot's
  319. # internal web server (usually the html.WebStatus page) is visible. This
  320. # typically uses the port number set in the Waterfall 'status' entry, but
  321. # with an externally-visible host name which the buildbot cannot figure out
  322. # without some help.
  323. c['buildbotURL'] = "http://buildbot.quagga.net/"
  324. ####### DB URL
  325. c['db'] = {
  326. # This specifies what database buildbot uses to store its state. You can leave
  327. # this at its default for all but the largest installations.
  328. 'db_url' : "sqlite:///state.sqlite",
  329. }
  330. #### debug
  331. c['debugPassword'] = debugPassword