Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

141 wiersze
3.3KB

  1. {{ansible_managed|comment}}
  2. from buildbot.plugins import *
  3. c = BuildmasterConfig = {}
  4. c['workers'] = []
  5. c['change_source'] = []
  6. c['schedulers'] = []
  7. c['builders'] = []
  8. c['services'] = []
  9. c['protocols'] = {
  10. 'pb': {
  11. 'port': "tcp:9989:interface=127.0.0.1"
  12. }
  13. }
  14. c['title'] = "buildbot title"
  15. c['titleURL'] = "https://github.com/covid-videoplattform"
  16. c['buildbotURL'] = "https://{{buildbot_server_name}}/"
  17. c['www'] = dict(
  18. port="unix:address=/run/buildbot/{{buildbot_server_name}}.www.sock",
  19. plugins = dict(
  20. waterfall_view={},
  21. console_view={},
  22. grid_view={},
  23. badges={"left_pad": 0, "right_pad": 0, "border_radius": 3, "style": "badgeio"},
  24. ),
  25. change_hook_dialects={
  26. {% if buildbot_github_change_hook %}
  27. 'github': {},
  28. {% endif %}
  29. {% if buildbot_gitea_change_hook %}
  30. 'gitea': {
  31. 'secret': '{{buildbot_gitea_webhook_secret}}',
  32. 'onlyIncludePushCommit': False,
  33. },
  34. {% endif %}
  35. },
  36. )
  37. c['db'] = {
  38. 'db_url' : "{{buildbot_database_url}}",
  39. }
  40. # Local Worker
  41. {% if buildbot_local_worker %}
  42. c['workers'].append(worker.LocalWorker("local-worker"))
  43. {% endif %}
  44. # Ansible Defined Workers
  45. {% for worker_name in buildbot_workers.keys() %}
  46. {% set worker = buildbot_workers[worker_name] %}
  47. c['workers'].append(worker.Worker('{{worker_name}}', '{{worker.password|default(ansible_local.buildbot.workers[worker_name].password)}}'))
  48. {% endfor %}
  49. # Hello World Example
  50. {% if buildbot_hello_world_example %}
  51. factory = util.BuildFactory()
  52. factory.addStep(steps.Git(repourl='git://github.com/buildbot/hello-world.git', mode='incremental'))
  53. factory.addStep(steps.ShellCommand(command=["trial", "hello"], env={"PYTHONPATH": "."}))
  54. c['builders'].append(
  55. util.BuilderConfig(
  56. name="hello-world",
  57. workernames=["local-worker"],
  58. factory=factory
  59. )
  60. )
  61. c['schedulers'].append(schedulers.ForceScheduler(
  62. name="force-hello-world",
  63. builderNames=["hello-world"],
  64. ))
  65. {% endif %}
  66. # Ansible Defined Builders
  67. {% for builder_name in buildbot_builders.keys() %}
  68. {% set builder = buildbot_builders[builder_name] %}
  69. factory = util.BuildFactory()
  70. {% for repo in builder.repos %}
  71. {% if repo.type | default('github') == 'github' %}
  72. factory.addStep(steps.GitHub(
  73. name='{{repo.name}}',
  74. repourl='{{repo.repourl}}',
  75. mode='incremental',
  76. workdir='{{repo.workdir}}',
  77. alwaysUseLatest=True,
  78. ))
  79. {% elif repo.type == 'gitea' %}
  80. factory.addStep(steps.Gitea(
  81. name='{{repo.name}}',
  82. repourl='{{repo.repourl}}',
  83. mode='incremental',
  84. workdir='{{repo.workdir}}',
  85. branch='{{repo.branch|default('master')}}',
  86. progress=True,
  87. logEnviron=False,
  88. ))
  89. {% endif %}
  90. {% endfor %}
  91. {% for cmd in builder.shell_commands %}
  92. factory.addStep(steps.ShellCommand(
  93. name='{{cmd.name}}',
  94. command='{{cmd.command}}',
  95. workdir='{{cmd.workdir}}',
  96. ))
  97. {% endfor %}
  98. c['builders'].append(
  99. util.BuilderConfig(
  100. name="{{builder_name}}",
  101. workernames={{builder.worker_names|to_json}},
  102. factory=factory
  103. )
  104. )
  105. c['schedulers'].append(schedulers.SingleBranchScheduler(
  106. name="{{builder_name}}",
  107. change_filter=util.ChangeFilter(branch='{{repo.branch|default('master')}}'),
  108. treeStableTimer=5,
  109. builderNames=['{{builder_name}}'],
  110. ))
  111. {% if builder.force_scheduler | default(false) %}
  112. c['schedulers'].append(schedulers.ForceScheduler(
  113. name="force-{{builder_name}}",
  114. builderNames=["{{builder_name}}"],
  115. ))
  116. {% endif %}
  117. {% endfor %}