|
- {{ansible_managed|comment}}
-
- from buildbot.plugins import *
- import glob, json
-
- c = BuildmasterConfig = {}
-
- c['workers'] = []
- c['change_source'] = []
- c['schedulers'] = []
- c['builders'] = []
- c['services'] = []
-
- c['protocols'] = {
- 'pb': {
- 'port': "tcp:9989:interface=127.0.0.1"
- }
- }
-
- c['title'] = "{{buildbot_title}}"
- c['titleURL'] = "{{buildbot_title_url}}"
-
- c['buildbotURL'] = "{{ buildbot_base_url }}"
-
- c['www'] = dict(
- port="unix:address=/run/buildbot/{{buildbot_server_name}}.www.sock",
- plugins = dict(
- waterfall_view={},
- console_view={},
- grid_view={},
- badges={"left_pad": 0, "right_pad": 0, "border_radius": 3, "style": "badgeio"},
- ),
- change_hook_dialects={
- {% if buildbot_github_change_hook %}
- 'github': {},
- {% endif %}
- {% if buildbot_gitea_change_hook %}
- 'gitea': {
- 'secret': '{{buildbot_gitea_webhook_secret}}',
- 'onlyIncludePushCommit': False,
- },
- {% endif %}
- },
- )
-
- c['db'] = {
- 'db_url' : "{{buildbot_database_url}}",
- }
-
-
- # Local Worker
-
- {% if buildbot_local_worker %}
- c['workers'].append(worker.LocalWorker("local-worker"))
- {% endif %}
-
-
- # External Workers Config
-
- workers_config_file_paths = glob.glob("*.workers.json")
- for workers_config_file_path in workers_config_file_paths:
- with open(workers_config_file_path) as workers_config_file:
- workers_config = json.load(workers_config_file)
- for (worker_name, worker_config) in workers_config.items():
- c['workers'].append(worker.Worker(worker_name, worker_config['password']))
-
-
- # Hello World Example
-
- {% if buildbot_hello_world_example %}
-
- factory = util.BuildFactory()
- factory.addStep(steps.Git(repourl='git://github.com/buildbot/hello-world.git', mode='incremental'))
- factory.addStep(steps.ShellCommand(command=["trial", "hello"], env={"PYTHONPATH": "."}))
-
- c['builders'].append(
- util.BuilderConfig(
- name="hello-world",
- workernames=["local-worker"],
- factory=factory
- )
- )
-
- c['schedulers'].append(schedulers.ForceScheduler(
- name="force-hello-world",
- builderNames=["hello-world"],
- ))
-
- {% endif %}
-
-
-
- # External Builders Config
-
- builders_config_file_paths = glob.glob("*.builders.json")
- for builders_config_file_path in builders_config_file_paths:
- with open(builders_config_file_path) as builders_config_file:
- builders_config = json.load(builders_config_file)
- for (builder_name, builder_config) in builders_config.items():
-
- factory = util.BuildFactory()
-
- c['builders'].append(
- util.BuilderConfig(
- name=builder_name,
- workernames=builder_config['worker_names'],
- factory=factory
- )
- )
-
- repo = builder_config['repo']
-
- if repo['type'] == 'github':
- factory.addStep(steps.GitHub(
- repourl=repo['url'],
- mode='incremental',
- branch=repo["branch"],
- workdir=repo['workdir'],
- progress=True,
- submodules=True,
- ))
- elif repo['type'] == 'gitea':
- factory.addStep(steps.Gitea(
- repourl=repo['url'],
- mode='incremental',
- branch=repo["branch"],
- workdir=repo['workdir'],
- progress=True,
- submodules=True,
- ))
-
- for cmd in builder_config['shell_commands']:
- factory.addStep(steps.ShellCommand(
- name=cmd['name'],
- command=cmd['command'],
- workdir=cmd['workdir'],
- ))
-
- c['schedulers'].append(schedulers.SingleBranchScheduler(
- name=builder_name,
- change_filter=util.ChangeFilter(branch=builder_config['repo']['branch']),
- treeStableTimer=5,
- builderNames=[builder_name],
- ))
-
- if ('force_scheduler' in builder_config) and (builder_config['force_scheduler'] == True):
- c['schedulers'].append(schedulers.ForceScheduler(
- name="build-%s" % builder_name,
- builderNames=[builder_name],
- ))
|