|
@@ -1,6 +1,7 @@ |
|
|
{{ansible_managed|comment}} |
|
|
{{ansible_managed|comment}} |
|
|
|
|
|
|
|
|
from buildbot.plugins import * |
|
|
from buildbot.plugins import * |
|
|
|
|
|
import glob, json |
|
|
|
|
|
|
|
|
c = BuildmasterConfig = {} |
|
|
c = BuildmasterConfig = {} |
|
|
|
|
|
|
|
@@ -48,17 +49,24 @@ c['db'] = { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Local Worker |
|
|
# Local Worker |
|
|
|
|
|
|
|
|
{% if buildbot_local_worker %} |
|
|
{% if buildbot_local_worker %} |
|
|
c['workers'].append(worker.LocalWorker("local-worker")) |
|
|
c['workers'].append(worker.LocalWorker("local-worker")) |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
# Ansible Defined Workers |
|
|
|
|
|
{% for worker_name in buildbot_workers.keys() %} |
|
|
|
|
|
{% set worker = buildbot_workers[worker_name] %} |
|
|
|
|
|
c['workers'].append(worker.Worker('{{worker_name}}', '{{worker.password|default(ansible_local.buildbot.workers[worker_name].password)}}')) |
|
|
|
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 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 |
|
|
# Hello World Example |
|
|
|
|
|
|
|
|
{% if buildbot_hello_world_example %} |
|
|
{% if buildbot_hello_world_example %} |
|
|
|
|
|
|
|
|
factory = util.BuildFactory() |
|
|
factory = util.BuildFactory() |
|
@@ -80,61 +88,58 @@ c['schedulers'].append(schedulers.ForceScheduler( |
|
|
|
|
|
|
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
# Ansible Defined Builders |
|
|
|
|
|
{% for builder_name in buildbot_builders.keys() %} |
|
|
|
|
|
{% set builder = buildbot_builders[builder_name] %} |
|
|
|
|
|
factory = util.BuildFactory() |
|
|
|
|
|
|
|
|
|
|
|
{#{% for repo in builder.repos %}#} |
|
|
|
|
|
{% set repo = builder.repo %} |
|
|
|
|
|
{% if repo.type | default('github') == 'github' %} |
|
|
|
|
|
factory.addStep(steps.GitHub( |
|
|
|
|
|
name='{{repo.name}}', |
|
|
|
|
|
repourl='{{repo.repourl}}', |
|
|
|
|
|
mode='incremental', |
|
|
|
|
|
workdir='{{repo.workdir}}', |
|
|
|
|
|
alwaysUseLatest=True, |
|
|
|
|
|
)) |
|
|
|
|
|
{% elif repo.type == 'gitea' %} |
|
|
|
|
|
factory.addStep(steps.Gitea( |
|
|
|
|
|
name='{{repo.name}}', |
|
|
|
|
|
repourl='{{repo.repourl}}', |
|
|
|
|
|
mode='incremental', |
|
|
|
|
|
workdir='{{repo.workdir}}', |
|
|
|
|
|
progress=True, |
|
|
|
|
|
logEnviron=False, |
|
|
|
|
|
)) |
|
|
|
|
|
{% endif %} |
|
|
|
|
|
{#{% endfor %}#} |
|
|
|
|
|
|
|
|
|
|
|
{% for cmd in builder.shell_commands %} |
|
|
|
|
|
factory.addStep(steps.ShellCommand( |
|
|
|
|
|
name='{{cmd.name}}', |
|
|
|
|
|
command='{{cmd.command}}', |
|
|
|
|
|
workdir='{{cmd.workdir}}', |
|
|
|
|
|
)) |
|
|
|
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
|
|
|
c['builders'].append( |
|
|
|
|
|
util.BuilderConfig( |
|
|
|
|
|
name="{{builder_name}}", |
|
|
|
|
|
workernames={{builder.worker_names|to_json}}, |
|
|
|
|
|
factory=factory |
|
|
|
|
|
) |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
c['schedulers'].append(schedulers.SingleBranchScheduler( |
|
|
|
|
|
name="{{builder_name}}", |
|
|
|
|
|
change_filter=util.ChangeFilter(branch='{{repo.branch|default('master')}}'), |
|
|
|
|
|
treeStableTimer=5, |
|
|
|
|
|
builderNames=['{{builder_name}}'], |
|
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
|
|
{% if builder.force_scheduler | default(false) %} |
|
|
|
|
|
c['schedulers'].append(schedulers.ForceScheduler( |
|
|
|
|
|
name="force-{{builder_name}}", |
|
|
|
|
|
builderNames=["{{builder_name}}"], |
|
|
|
|
|
)) |
|
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
# 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"], |
|
|
|
|
|
progress=True, |
|
|
|
|
|
)) |
|
|
|
|
|
elif repo['type'] == 'gitea': |
|
|
|
|
|
factory.addStep(steps.Gitea( |
|
|
|
|
|
repourl=repo['url'], |
|
|
|
|
|
mode='incremental', |
|
|
|
|
|
branch=repo["branch"], |
|
|
|
|
|
progress=True, |
|
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
|
|
for cmd in builder_config['shell_commands']: |
|
|
|
|
|
factory.addStep(steps.ShellCommand( |
|
|
|
|
|
name=cmd['name'], |
|
|
|
|
|
command=cmd['command'], |
|
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
|
|
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], |
|
|
|
|
|
)) |