master.cfg 14 KB

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