選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. {{ansible_managed|comment}}
  2. from buildbot.plugins import *
  3. import glob, json
  4. c = BuildmasterConfig = {}
  5. c['workers'] = []
  6. c['change_source'] = []
  7. c['schedulers'] = []
  8. c['builders'] = []
  9. c['services'] = []
  10. c['protocols'] = {
  11. 'pb': {
  12. 'port': "tcp:9989:interface=127.0.0.1"
  13. }
  14. }
  15. c['title'] = "{{buildbot_title}}"
  16. c['titleURL'] = "{{buildbot_title_url}}"
  17. c['buildbotURL'] = "{{ buildbot_base_url }}"
  18. c['www'] = dict(
  19. port="unix:address=/run/buildbot/{{buildbot_server_name}}.www.sock",
  20. plugins = dict(
  21. waterfall_view={},
  22. console_view={},
  23. grid_view={},
  24. badges={"left_pad": 0, "right_pad": 0, "border_radius": 3, "style": "badgeio"},
  25. ),
  26. change_hook_dialects={
  27. {% if buildbot_github_change_hook %}
  28. 'github': {},
  29. {% endif %}
  30. {% if buildbot_gitea_change_hook %}
  31. 'gitea': {
  32. 'secret': '{{buildbot_gitea_webhook_secret}}',
  33. 'onlyIncludePushCommit': False,
  34. },
  35. {% endif %}
  36. },
  37. )
  38. {% if buildbot_with_gitea_auth %}
  39. c['www']['auth'] = util.GiteaAuth(
  40. endpoint='{{buildbot_gitea_auth_endpoint}}',
  41. client_id='{{buildbot_gitea_auth_client_id}}',
  42. client_secret='{{buildbot_gitea_auth_client_secret}}',
  43. )
  44. c['www']['authz'] = util.Authz(
  45. allowRules=[
  46. #util.AnyControlEndpointMatcher(role="admins"),
  47. util.AnyEndpointMatcher(role="admins"),
  48. ],
  49. roleMatchers=[
  50. util.RolesFromUsername(roles=["admins"], usernames={{buildbot_admin_usernames|to_json}}),
  51. ]
  52. )
  53. {% endif %}
  54. c['db'] = {
  55. 'db_url' : "{{buildbot_database_url}}",
  56. }
  57. # Local Worker
  58. {% if buildbot_local_worker %}
  59. c['workers'].append(worker.LocalWorker("local-worker"))
  60. {% endif %}
  61. # External Workers Config
  62. workers_config_file_paths = glob.glob("*.workers.json")
  63. for workers_config_file_path in workers_config_file_paths:
  64. with open(workers_config_file_path) as workers_config_file:
  65. workers_config = json.load(workers_config_file)
  66. for (worker_name, worker_config) in workers_config.items():
  67. c['workers'].append(worker.Worker(worker_name, worker_config['password']))
  68. # Hello World Example
  69. {% if buildbot_hello_world_example %}
  70. factory = util.BuildFactory()
  71. factory.addStep(steps.Git(repourl='git://github.com/buildbot/hello-world.git', mode='incremental'))
  72. factory.addStep(steps.ShellCommand(command=["trial", "hello"], env={"PYTHONPATH": "."}))
  73. c['builders'].append(
  74. util.BuilderConfig(
  75. name="hello-world",
  76. workernames=["local-worker"],
  77. factory=factory
  78. )
  79. )
  80. c['schedulers'].append(schedulers.ForceScheduler(
  81. name="force-hello-world",
  82. builderNames=["hello-world"],
  83. ))
  84. {% endif %}
  85. # External Builders Config
  86. builders_config_file_paths = glob.glob("*.builders.json")
  87. for builders_config_file_path in builders_config_file_paths:
  88. with open(builders_config_file_path) as builders_config_file:
  89. builders_config = json.load(builders_config_file)
  90. for (builder_name, builder_config) in builders_config.items():
  91. factory = util.BuildFactory()
  92. c['builders'].append(
  93. util.BuilderConfig(
  94. name=builder_name,
  95. workernames=builder_config['worker_names'],
  96. factory=factory
  97. )
  98. )
  99. repo = builder_config['repo']
  100. if repo['type'] == 'github':
  101. factory.addStep(steps.GitHub(
  102. repourl=repo['url'],
  103. mode='incremental',
  104. branch=repo["branch"],
  105. workdir=repo['workdir'],
  106. progress=True,
  107. submodules=True,
  108. alwaysUseLatest=True,
  109. ))
  110. elif repo['type'] == 'gitea':
  111. factory.addStep(steps.Gitea(
  112. repourl=repo['url'],
  113. mode='incremental',
  114. branch=repo["branch"],
  115. workdir=repo['workdir'],
  116. progress=True,
  117. submodules=True,
  118. alwaysUseLatest=True,
  119. ))
  120. for cmd in builder_config['shell_commands']:
  121. factory.addStep(steps.ShellCommand(
  122. name=cmd['name'],
  123. command=cmd['command'],
  124. workdir=cmd['workdir'],
  125. ))
  126. c['schedulers'].append(schedulers.SingleBranchScheduler(
  127. name=builder_name,
  128. change_filter=util.ChangeFilter(
  129. branch=builder_config['repo']['branch'],
  130. project=builder_config['repo']['project'],
  131. ),
  132. treeStableTimer=5,
  133. builderNames=[builder_name],
  134. ))
  135. if ('force_scheduler' in builder_config) and (builder_config['force_scheduler'] == True):
  136. c['schedulers'].append(schedulers.ForceScheduler(
  137. name="build-%s" % builder_name,
  138. builderNames=[builder_name],
  139. ))