from buildbot.plugins import changes, schedulers, steps, util, worker REPOURL_DOCKER = 'https://git.blackfinn.de/docker/bicycle-statistics.git' REPOYRL_PYTHON = 'https://git.blackfinn.de/python/bicycle-statistics.git' BRANCH = util.Property('branch', default='master') COMMANDS = [] COMMANDS.append(['docker', 'build', '--no-cache', '-t', 'bicycle-statistics', '.']) COMMANDS.append(['docker', 'rm', '-f', 'bicycle-statistics']) COMMANDS.append(['docker', 'run', '-d', '-v', '/srv/nextcloud/data/tkl/files/Bicycle:/bs_in', '-v', '/srv/bicycle.blackfinn.de/data:/bs_out', '--name', 'bicycle-statistics', '--restart', 'always', 'bicycle-statistics']) # Change sources cs_bicycle_python = changes.GitPoller(project='bicycle-statistics-python', repourl=REPOYRL_PYTHON, branches=True, pollInterval=60) cs_bicycle_docker = changes.GitPoller(project='bicycle-statistics-docker', repourl=REPOURL_DOCKER, branches=True, pollInterval=60) # Factory factory = util.BuildFactory() factory.addStep(steps.Git(repourl=REPOURL_DOCKER, branch=BRANCH)) for cmd in COMMANDS: factory.addStep(steps.ShellCommand(command=cmd)) # Worker bicycle_worker = worker.DockerLatentWorker('buildbot-docker-worker', 'pass', docker_host='tcp://192.168.178.39:2375', image='buildbot-docker-worker', volumes=['/var/run/docker.sock:/var/run/docker.sock']) # Builder bicycle_builder = util.BuilderConfig(name='bicycle_statistics', workernames=["buildbot-docker-worker"], factory=factory) # Schedulers change_scheduler = schedulers.SingleBranchScheduler(name="bicycle_statistics", change_filter=util.ChangeFilter(project=['bicycle-statistics-python', 'bicycle-statistics-docker']), treeStableTimer=None, builderNames=["bicycle_statistics"]) force_scheduler = schedulers.ForceScheduler(name="force_bicycle-statistics", builderNames=["bicycle_statistics"]) def append(c): c['change_source'].append(cs_bicycle_python) c['change_source'].append(cs_bicycle_docker) c['workers'].append(bicycle_worker) c['builders'].append(bicycle_builder) c['schedulers'].append(change_scheduler) c['schedulers'].append(force_scheduler) return c