buildbot.cfg 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. # -*- python -*-
  2. # ex: set syntax=python:
  3. # This is a sample buildmaster config file. It must be installed as
  4. # 'master.cfg' in your buildmaster's base directory.
  5. # This is the dictionary that the buildmaster pays attention to. We also use
  6. # a shorter alias to save typing.
  7. c = BuildmasterConfig = {}
  8. ####### BUILDSLAVES
  9. # The 'slaves' list defines the set of recognized buildslaves. Each element is
  10. # a BuildSlave object, specifying a unique slave name and password. The same
  11. # slave name and password must be configured on the slave.
  12. from buildbot.buildslave import BuildSlave
  13. c['slaves'] = [BuildSlave("buildslave", "Suridocker")]
  14. # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
  15. # This must match the value configured into the buildslaves (with their
  16. # --master option)
  17. c['slavePortnum'] = 9989
  18. ####### CHANGESOURCES
  19. # the 'change_source' setting tells the buildmaster how it should find out
  20. # about source code changes. Here we point to the buildbot clone of pyflakes.
  21. from buildbot.changes.gitpoller import GitPoller
  22. c['change_source'] = []
  23. c['change_source'].append(GitPoller(
  24. '/data/oisf/.git/',
  25. workdir='gitpoller-workdir', branches = ['master'],
  26. pollinterval=300, project='suricata'))
  27. ####### SCHEDULERS
  28. # Configure the Schedulers, which decide how to react to incoming changes. In this
  29. # case, just kick off a 'runtests' build
  30. from buildbot.schedulers.basic import SingleBranchScheduler
  31. #from buildbot.schedulers.forcesched import ForceScheduler
  32. from buildbot.changes import filter
  33. c['schedulers'] = []
  34. c['schedulers'].append(SingleBranchScheduler(
  35. name="master",
  36. change_filter=filter.ChangeFilter(branch='master'),
  37. treeStableTimer=None,
  38. builderNames=["features","profiling","clang"]))
  39. #c['schedulers'].append(ForceScheduler(
  40. # name="force",
  41. # builderNames=["builds","debug"]))
  42. ####### BUILDERS
  43. # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
  44. # what steps, and which slaves can execute them. Note that any particular build will
  45. # only take place on one slave.
  46. from buildbot.process.factory import BuildFactory
  47. #from buildbot.steps.source.git import Git
  48. from buildbot.steps.source import Git
  49. from buildbot.steps.shell import ShellCommand
  50. def SuriBuildFactory(repo='/data/oisf/'):
  51. factory = BuildFactory()
  52. factory.addStep(Git(repourl=repo, mode='copy'))
  53. factory.addStep(ShellCommand(command=["rm", "-rf", "libhtp"]))
  54. factory.addStep(ShellCommand(command=["git", "clone", "-b", "0.5.x", "/data/oisf/libhtp/.git/", "libhtp"]))
  55. return factory
  56. factory = SuriBuildFactory()
  57. # run the tests (note that this will require that 'trial' is installed)
  58. factory.addStep(ShellCommand(command=["./autogen.sh"]))
  59. factory.addStep(ShellCommand(command=["./configure"]))
  60. factory.addStep(ShellCommand(command=["make"]))
  61. factory.addStep(ShellCommand(command=["make", "clean"]))
  62. #factory.addStep(ShellCommand(command=["make", "distcheck"]))
  63. factory_devel = SuriBuildFactory()
  64. # run the tests (note that this will require that 'trial' is installed)
  65. factory_devel.addStep(ShellCommand(command=["./autogen.sh"]))
  66. factory_devel.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests"]))
  67. factory_devel.addStep(ShellCommand(command=["make"]))
  68. factory_devel.addStep(ShellCommand(command=["make", "clean"]))
  69. #factory_devel.addStep(ShellCommand(command=["make", "distcheck"], env={'DISTCHECK_CONFIGURE_FLAGS': "--enable-debug --enable-unittests"}))
  70. factory_profiling = SuriBuildFactory()
  71. # run the tests (note that this will require that 'trial' is installed)
  72. factory_profiling.addStep(ShellCommand(command=["./autogen.sh"]))
  73. factory_profiling.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-profiling","--enable-unittests"]))
  74. factory_profiling.addStep(ShellCommand(command=["make"]))
  75. factory_profiling.addStep(ShellCommand(command=["make", "clean"]))
  76. #factory_profiling.addStep(ShellCommand(command=["make", "distcheck"],env={'DISTCHECK_CONFIGURE_FLAGS': "--enable-debug --enable-profiling --enable-unittests"}))
  77. factory_clang = SuriBuildFactory()
  78. # run the tests (note that this will require that 'trial' is installed)
  79. factory_clang.addStep(ShellCommand(command=["./autogen.sh"]))
  80. #factory_clang.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","CC=clang","CFLAGS=-fsanitize=address"]))
  81. factory_clang.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","CC=clang","ac_cv_func_malloc_0_nonnull=yes","ac_cv_func_realloc_0_nonnull=yes"]))
  82. factory_clang.addStep(ShellCommand(command=["make"]))
  83. factory_clang.addStep(ShellCommand(command=["make", "clean"]))
  84. factory_clang_32 = SuriBuildFactory()
  85. # run the tests (note that this will require that 'trial' is installed)
  86. factory_clang_32.addStep(ShellCommand(command=["./autogen.sh"]))
  87. factory_clang_32.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","CC=clang","CFLAGS=-fsanitize=address","ac_cv_func_malloc_0_nonnull=yes","ac_cv_func_realloc_0_nonnull=yes"]))
  88. factory_clang_32.addStep(ShellCommand(command=["make"]))
  89. factory_clang_32.addStep(ShellCommand(command=["make", "clean"]))
  90. factory_features = SuriBuildFactory()
  91. # run the tests (note that this will require that 'trial' is installed)
  92. factory_features.addStep(ShellCommand(command=["./autogen.sh"]))
  93. factory_features.addStep(ShellCommand(command=["./configure","--enable-debug","--enable-unittests","--enable-nfqueue","--enable-nflog", "--enable-lua"]))
  94. factory_features.addStep(ShellCommand(command=["make"]))
  95. factory_features.addStep(ShellCommand(command=["make", "clean"]))
  96. import psutil
  97. factory_features.addStep(ShellCommand(command=["make", "distcheck"],env={'DISTCHECK_CONFIGURE_FLAGS': "--enable-debug --enable-unittests --enable-nfqueue --enable-nflog --enable-lua", "CONCURRENCY_LEVEL": str(psutil.cpu_count())}))
  98. import os
  99. PCAP_PATH='/data/oisf/qa/docker/pcaps/'
  100. (_, _, pcaps_list) = os.walk(PCAP_PATH).next()
  101. pcaps_list = [ os.path.join(PCAP_PATH, pcap) for pcap in pcaps_list if pcap.endswith(".pcap") ]
  102. factory_stress_pcap = SuriBuildFactory()
  103. # run the tests (note that this will require that 'trial' is installed)
  104. factory_stress_pcap.addStep(ShellCommand(command=["./autogen.sh"]))
  105. factory_stress_pcap.addStep(ShellCommand(command=["./configure","--enable-debug-validation"],env={"CFLAGS" : "-fsanitize=address -fno-omit-frame-pointer"}))
  106. factory_stress_pcap.addStep(ShellCommand(command=["make"]))
  107. factory_stress_pcap.addStep(ShellCommand(command=["make","install"]))
  108. factory_stress_pcap.addStep(ShellCommand(command=["rm", "-f", "/usr/local/etc/suricata/suricata.yaml"]))
  109. factory_stress_pcap.addStep(ShellCommand(command=["make","install-conf"]))
  110. factory_stress_pcap.addStep(ShellCommand(command=["make","clean"]))
  111. factory_stress_pcap.addStep(ShellCommand(command=["ldconfig"]))
  112. for pfile in pcaps_list:
  113. factory_stress_pcap.addStep(ShellCommand(command=["/usr/local/bin/suricata","-r",pfile,"--init-errors-fatal","-S","/data/oisf/rules/http-events.rules"]))
  114. factory_stress_pcap.addStep(ShellCommand(command=["rm", "-rf", "/usr/local/var/log/suricata/"]))
  115. from buildbot.config import BuilderConfig
  116. def SuriBuilderConfig(*args, **kwargs):
  117. if not kwargs.has_key('category'):
  118. kwargs['category']='default'
  119. return BuilderConfig(*args, **kwargs)
  120. c['builders'] = []
  121. c['builders'].append(
  122. SuriBuilderConfig(name="gcc",
  123. slavename="buildslave",
  124. factory=factory))
  125. c['schedulers'].append(SingleBranchScheduler(
  126. name="build",
  127. change_filter=filter.ChangeFilter(branch='master'),
  128. treeStableTimer=None,
  129. builderNames=["gcc"]))
  130. c['builders'].append(
  131. SuriBuilderConfig(name="debug",
  132. slavename="buildslave",
  133. factory=factory_devel))
  134. c['schedulers'].append(SingleBranchScheduler(
  135. name="debug",
  136. change_filter=filter.ChangeFilter(branch='master'),
  137. treeStableTimer=None,
  138. builderNames=["debug"]))
  139. c['builders'].append(
  140. SuriBuilderConfig(name="profiling",
  141. slavename="buildslave",
  142. factory=factory_profiling))
  143. c['builders'].append(
  144. SuriBuilderConfig(name="clang",
  145. slavename="buildslave",
  146. factory=factory_clang_32))
  147. c['builders'].append(
  148. SuriBuilderConfig(name="features",
  149. slavename="buildslave",
  150. factory=factory_features))
  151. c['builders'].append(
  152. SuriBuilderConfig(name="pcaps",
  153. slavename="buildslave",
  154. factory=factory_stress_pcap))
  155. from buildbot import locks
  156. build_lock = locks.SlaveLock("slave_builds", maxCount = 1)
  157. from buildbot.schedulers.forcesched import *
  158. c['schedulers'].append(ForceScheduler(name="force", builderNames = [ builder.getConfigDict()['name'] for builder in c['builders'] ]))
  159. c['status'] = []
  160. from buildbot.status import html
  161. from buildbot.status.web import authz, auth
  162. authz_cfg=authz.Authz(
  163. # change any of these to True to enable; see the manual for more
  164. # options
  165. #auth=auth.BasicAuth(users),
  166. gracefulShutdown = False,
  167. forceBuild = True, # use this to test your slave once it is set up
  168. forceAllBuilds = True,
  169. pingBuilder = True,
  170. stopBuild = True,
  171. stopAllBuilds = True,
  172. cancelPendingBuild = True,
  173. )
  174. c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
  175. ####### PROJECT IDENTITY
  176. # the 'title' string will appear at the top of this buildbot
  177. # installation's html.WebStatus home page (linked to the
  178. # 'titleURL') and is embedded in the title of the waterfall HTML page.
  179. c['title'] = "Suricata"
  180. c['titleURL'] = "https://redmine.openinfosecfoundation.org/projects/suricata"
  181. # the 'buildbotURL' string should point to the location where the buildbot's
  182. # internal web server (usually the html.WebStatus page) is visible. This
  183. # typically uses the port number set in the Waterfall 'status' entry, but
  184. # with an externally-visible host name which the buildbot cannot figure out
  185. # without some help.
  186. c['buildbotURL'] = "http://localhost:8010/"
  187. ####### DB URL
  188. c['db'] = {
  189. # This specifies what database buildbot uses to store its state. You can leave
  190. # this at its default for all but the largest installations.
  191. 'db_url' : "sqlite:///state.sqlite",
  192. }