diff --git a/config/__init__.py b/config/__init__.py index e69de29..16aff3d 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -0,0 +1,4 @@ +from .change_sources import append +from .schedulers import append +from .workers import append + diff --git a/config/__pycache__/__init__.cpython-36.pyc b/config/__pycache__/__init__.cpython-36.pyc index 0155a51..66a1f18 100644 Binary files a/config/__pycache__/__init__.cpython-36.pyc and b/config/__pycache__/__init__.cpython-36.pyc differ diff --git a/config/__pycache__/change_sources.cpython-36.pyc b/config/__pycache__/change_sources.cpython-36.pyc index 75be9ee..2092ddb 100644 Binary files a/config/__pycache__/change_sources.cpython-36.pyc and b/config/__pycache__/change_sources.cpython-36.pyc differ diff --git a/config/__pycache__/schedulers.cpython-36.pyc b/config/__pycache__/schedulers.cpython-36.pyc index 9af26d3..a3a3ca4 100644 Binary files a/config/__pycache__/schedulers.cpython-36.pyc and b/config/__pycache__/schedulers.cpython-36.pyc differ diff --git a/config/__pycache__/workers.cpython-36.pyc b/config/__pycache__/workers.cpython-36.pyc index 5be240d..3318ddc 100644 Binary files a/config/__pycache__/workers.cpython-36.pyc and b/config/__pycache__/workers.cpython-36.pyc differ diff --git a/config/builders/__init__.py b/config/builders/__init__.py index e69de29..8555343 100644 --- a/config/builders/__init__.py +++ b/config/builders/__init__.py @@ -0,0 +1,9 @@ +from .ads1115 import append +from .bicycle_statistics import append +from .gpio_ftdi import append +from .gpio_sys import append +from .i2c_bb import append +from .periflash import append +from .test_c import append +from .voltage_app import append + diff --git a/config/builders/__pycache__/__init__.cpython-36.pyc b/config/builders/__pycache__/__init__.cpython-36.pyc index 2a1fccc..b61dd1c 100644 Binary files a/config/builders/__pycache__/__init__.cpython-36.pyc and b/config/builders/__pycache__/__init__.cpython-36.pyc differ diff --git a/config/builders/__pycache__/ads1115.cpython-36.pyc b/config/builders/__pycache__/ads1115.cpython-36.pyc index 4c92dd5..714c945 100644 Binary files a/config/builders/__pycache__/ads1115.cpython-36.pyc and b/config/builders/__pycache__/ads1115.cpython-36.pyc differ diff --git a/config/builders/__pycache__/bicycle_statistics.cpython-36.pyc b/config/builders/__pycache__/bicycle_statistics.cpython-36.pyc index 615696a..0a89df6 100644 Binary files a/config/builders/__pycache__/bicycle_statistics.cpython-36.pyc and b/config/builders/__pycache__/bicycle_statistics.cpython-36.pyc differ diff --git a/config/builders/__pycache__/gpio_ftdi.cpython-36.pyc b/config/builders/__pycache__/gpio_ftdi.cpython-36.pyc index 60d1fe0..86a77af 100644 Binary files a/config/builders/__pycache__/gpio_ftdi.cpython-36.pyc and b/config/builders/__pycache__/gpio_ftdi.cpython-36.pyc differ diff --git a/config/builders/__pycache__/periflash.cpython-36.pyc b/config/builders/__pycache__/periflash.cpython-36.pyc new file mode 100644 index 0000000..92d58a3 Binary files /dev/null and b/config/builders/__pycache__/periflash.cpython-36.pyc differ diff --git a/config/builders/bicycle_statistics.py b/config/builders/bicycle_statistics.py index 31b92b1..5d0ac13 100644 --- a/config/builders/bicycle_statistics.py +++ b/config/builders/bicycle_statistics.py @@ -1,19 +1,60 @@ -from buildbot.plugins import steps, util +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.ShellCommand(command=['git', 'clone', '--branch', 'master', - 'https://git.blackfinn.de/docker/bicycle-statistics.git'])) -factory.addStep(steps.ShellCommand(command=['docker', 'build', '--no-cache', '-t', 'bicycle-statistics', - './bicycle-statistics'])) -factory.addStep(steps.ShellCommand(command=['docker', 'rm', '-f', 'bicycle-statistics'])) -factory.addStep(steps.ShellCommand(command=['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'])) +factory.addStep(steps.Git(repourl=REPOURL_DOCKER, branch=BRANCH)) -builder = util.BuilderConfig(name='bicycle_statistics', workernames=["buildbot-cpp-worker"], - factory=factory) +for cmd in COMMANDS: + factory.addStep(steps.ShellCommand(command=cmd)) -def append(builders): - builders.append(builder) - return builders +# 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 diff --git a/config/builders/periflash.py b/config/builders/periflash.py new file mode 100644 index 0000000..cb8fa48 --- /dev/null +++ b/config/builders/periflash.py @@ -0,0 +1,25 @@ +from buildbot.plugins import schedulers, steps, util, worker + +factory = util.BuildFactory() +factory.addStep(steps.GitLab(repourl='git@gitlab.com:tkla/periflash.git', + branch=util.Property('branch', default='master'))) + +periflash_worker = worker.DockerLatentWorker('periflash-worker', 'pass', + docker_host='tcp://192.168.178.39:2375', + image='buildbot-cpp-worker') + + +builder = util.BuilderConfig(name='periflash', + workernames=['periflash-worker'], + factory=factory) + +scheduler = schedulers.SingleBranchScheduler(name="periflash", + change_filter=util.ChangeFilter(project='periflash', branch=util.Property('branch', default='master')), + treeStableTimer=None, builderNames=["periflash"]) + +def append(c): + c['workers'].append(periflash_worker) + c['builders'].append(builder) + c['schedulers'].append(scheduler) + + return c diff --git a/config/change_sources.py b/config/change_sources.py index d278b3a..f825f8f 100644 --- a/config/change_sources.py +++ b/config/change_sources.py @@ -5,45 +5,34 @@ cs_test_c = changes.GitPoller(project='test.c', branches=True, pollInterval=300) ## gpio_ftdi -cs_gpio_ftdi = changes.GitPoller(project='gpio_ftdi', - repourl='https://git.blackfinn.de/adc_gpio_i2c/gpio_ftdi.git', - branches=True, pollInterval=60) +#cs_gpio_ftdi = changes.GitPoller(project='gpio_ftdi', +# repourl='https://git.blackfinn.de/adc_gpio_i2c/gpio_ftdi.git', +# branches=True, pollInterval=60) ## gpio_sys -cs_gpio_sys = changes.GitPoller(project='gpio_sys', - repourl='https://git.blackfinn.de/adc_gpio_i2c/gpio_sys.git', - branches=True, pollInterval=60) +#cs_gpio_sys = changes.GitPoller(project='gpio_sys', +# repourl='https://git.blackfinn.de/adc_gpio_i2c/gpio_sys.git', +# branches=True, pollInterval=60) ## i2c_bb -cs_i2c_bb = changes.GitPoller(project='i2c_bb', - repourl='https://git.blackfinn.de/adc_gpio_i2c/i2c_bb.git', - branches=True, pollInterval=60) +#cs_i2c_bb = changes.GitPoller(project='i2c_bb', +# repourl='https://git.blackfinn.de/adc_gpio_i2c/i2c_bb.git', +# branches=True, pollInterval=60) ## ads1115 -cs_ads1115 = changes.GitPoller(project='ads1115', - repourl='https://git.blackfinn.de/adc_gpio_i2c/ads1115.git', - branches=True, pollInterval=60) +#cs_ads1115 = changes.GitPoller(project='ads1115', +# repourl='https://git.blackfinn.de/adc_gpio_i2c/ads1115.git', +# branches=True, pollInterval=60) ## voltage_app -cs_voltage_app = changes.GitPoller(project='voltage_app', - repourl='https://git.blackfinn.de/adc_gpio_i2c/voltage_app.git', - branches=True, pollInterval=60) - -## bicycle-statistics -cs_bicycle_python = changes.GitPoller(project='bicycle-statistics-python', - repourl='https://git.blackfinn.de/python/bicycle-statistics.git', - branches=True, pollInterval=60) -cs_bicycle_docker = changes.GitPoller(project='bicycle-statistics-docker', - repourl='https://git.blackfinn.de/docker/bicycle-statistics.git', - branches=True, pollInterval=60) - +#cs_voltage_app = changes.GitPoller(project='voltage_app', +# repourl='https://git.blackfinn.de/adc_gpio_i2c/voltage_app.git', +# branches=True, pollInterval=60) def append(change_sources): change_sources.append(cs_test_c) - change_sources.append(cs_gpio_ftdi) - change_sources.append(cs_gpio_sys) - change_sources.append(cs_i2c_bb) - change_sources.append(cs_ads1115) - change_sources.append(cs_voltage_app) - change_sources.append(cs_bicycle_python) - change_sources.append(cs_bicycle_docker) +# change_sources.append(cs_gpio_ftdi) +# change_sources.append(cs_gpio_sys) +# change_sources.append(cs_i2c_bb) +# change_sources.append(cs_ads1115) +# change_sources.append(cs_voltage_app) return change_sources diff --git a/config/schedulers.py b/config/schedulers.py index 1e4e472..3353983 100644 --- a/config/schedulers.py +++ b/config/schedulers.py @@ -5,59 +5,49 @@ sched_a1 = schedulers.SingleBranchScheduler(name="test_c", treeStableTimer=None, builderNames=["test.c"]) sched_a2 = schedulers.ForceScheduler(name="force_test_c", builderNames=["test.c"]) -sched_b1 = schedulers.SingleBranchScheduler(name="gpio_ftdi", - change_filter=util.ChangeFilter(project='gpio_ftdi'), - treeStableTimer=None, builderNames=["gpio_ftdi"]) +#sched_b1 = schedulers.SingleBranchScheduler(name="gpio_ftdi", +# change_filter=util.ChangeFilter(project='gpio_ftdi'), +# treeStableTimer=None, builderNames=["gpio_ftdi"]) -sched_b2 = schedulers.ForceScheduler(name="force_gpio_ftdi", builderNames=["gpio_ftdi"]) +#sched_b2 = schedulers.ForceScheduler(name="force_gpio_ftdi", builderNames=["gpio_ftdi"]) -sched_c1 = schedulers.SingleBranchScheduler(name="gpio_sys", - change_filter=util.ChangeFilter(project='gpio_sys'), - treeStableTimer=None, builderNames=["gpio_sys"]) -sched_c2 = schedulers.ForceScheduler(name="force_gpio_sys", builderNames=["gpio_sys"]) +#sched_c1 = schedulers.SingleBranchScheduler(name="gpio_sys", +# change_filter=util.ChangeFilter(project='gpio_sys'), +# treeStableTimer=None, builderNames=["gpio_sys"]) +#sched_c2 = schedulers.ForceScheduler(name="force_gpio_sys", builderNames=["gpio_sys"]) -sched_d1 = schedulers.SingleBranchScheduler(name="i2c_bb", - change_filter=util.ChangeFilter(project='i2c_bb'), - treeStableTimer=None, builderNames=["i2c_bb"]) +#sched_d1 = schedulers.SingleBranchScheduler(name="i2c_bb", +# change_filter=util.ChangeFilter(project='i2c_bb'), +# treeStableTimer=None, builderNames=["i2c_bb"]) -sched_d2 = schedulers.ForceScheduler(name="force_i2c_bb", builderNames=["i2c_bb"]) +#sched_d2 = schedulers.ForceScheduler(name="force_i2c_bb", builderNames=["i2c_bb"]) -sched_e1 = schedulers.SingleBranchScheduler(name="ads1115", - change_filter=util.ChangeFilter(project=['i2c_bb', 'ads1115']), - treeStableTimer=None, builderNames=["ads1115"]) +#sched_e1 = schedulers.SingleBranchScheduler(name="ads1115", +# change_filter=util.ChangeFilter(project=['i2c_bb', 'ads1115']), +# treeStableTimer=None, builderNames=["ads1115"]) -sched_e2 = schedulers.ForceScheduler(name="force_ads1115", builderNames=["ads1115"]) +#sched_e2 = schedulers.ForceScheduler(name="force_ads1115", builderNames=["ads1115"]) -sched_f1 = schedulers.SingleBranchScheduler(name="voltage_app", - change_filter=util.ChangeFilter(project=['voltage_app', - 'ads1115', - 'i2c_bb']), - treeStableTimer=None, builderNames=["voltage_app"]) - -sched_f2 = schedulers.ForceScheduler(name="force_voltage_app", builderNames=["voltage_app"]) - -sched_g1 = schedulers.SingleBranchScheduler(name="bicycle_statistics", - change_filter=util.ChangeFilter(project=['bicycle-statistics-python', - 'bicycle-statistics-docker']), - treeStableTimer=None, builderNames=["bicycle_statistics"]) - -sched_g2 = schedulers.ForceScheduler(name="force_bicycle-statistics", builderNames=["bicycle_statistics"]) +#sched_f1 = schedulers.SingleBranchScheduler(name="voltage_app", +# change_filter=util.ChangeFilter(project=['voltage_app', +# 'ads1115', +# 'i2c_bb']), +# treeStableTimer=None, builderNames=["voltage_app"]) +#sched_f2 = schedulers.ForceScheduler(name="force_voltage_app", builderNames=["voltage_app"]) def append(schedulers): schedulers.append(sched_a1) schedulers.append(sched_a2) - schedulers.append(sched_b1) - schedulers.append(sched_b2) - schedulers.append(sched_c1) - schedulers.append(sched_c2) - schedulers.append(sched_d1) - schedulers.append(sched_d2) - schedulers.append(sched_e1) - schedulers.append(sched_e2) - schedulers.append(sched_f1) - schedulers.append(sched_f2) - schedulers.append(sched_g1) - schedulers.append(sched_g2) +# schedulers.append(sched_b1) +# schedulers.append(sched_b2) +# schedulers.append(sched_c1) +# schedulers.append(sched_c2) +# schedulers.append(sched_d1) +# schedulers.append(sched_d2) +# schedulers.append(sched_e1) +# schedulers.append(sched_e2) +# schedulers.append(sched_f1) +# schedulers.append(sched_f2) return schedulers diff --git a/config/workers.py b/config/workers.py index 8dc4b58..0678880 100644 --- a/config/workers.py +++ b/config/workers.py @@ -4,13 +4,7 @@ cpp_worker = worker.DockerLatentWorker('buildbot-cpp-worker', 'pass', docker_host='tcp://192.168.178.39:2375', image='buildbot-cpp-worker') -docker_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']) - def append(workers): workers.append(cpp_worker) - workers.append(docker_worker) return workers diff --git a/master.cfg b/master.cfg index 7b2c862..82d2276 100644 --- a/master.cfg +++ b/master.cfg @@ -3,39 +3,23 @@ from buildbot.plugins import * -import config.workers +#import config.workers import config.change_sources import config.schedulers -import config.builders.test_c -import config.builders.gpio_ftdi -import config.builders.gpio_sys -import config.builders.i2c_bb -import config.builders.ads1115 -import config.builders.voltage_app -import config.builders.bicycle_statistics +from config.builders import * c = BuildmasterConfig = {} +#c['secretsProviders'] = [secrets.SecretInAFile(dirname='.ssh/')] + c['workers'] = [] -c['workers'] = config.workers.append(c['workers']) - c['protocols'] = {'pb': {'port': 9989}} - c['change_source'] = [] -c['change_source'] = config.change_sources.append(c['change_source']) - c['schedulers'] = [] -c['schedulers'] = config.schedulers.append(c['schedulers']) - c['builders'] = [] -c['builders'] = config.builders.test_c.append(c['builders']) -c['builders'] = config.builders.gpio_ftdi.append(c['builders']) -c['builders'] = config.builders.gpio_sys.append(c['builders']) -c['builders'] = config.builders.i2c_bb.append(c['builders']) -c['builders'] = config.builders.ads1115.append(c['builders']) -c['builders'] = config.builders.voltage_app.append(c['builders']) -c['builders'] = config.builders.bicycle_statistics.append(c['builders']) +c = config.builders.periflash.append(c) +c = config.builders.bicycle_statistics.append(c) ####### BUILDBOT SERVICES @@ -61,7 +45,12 @@ c['titleURL'] = "https://build.blackfinn.de/" c['buildbotURL'] = "https://build.blackfinn.de/" # minimalistic config to activate new web UI -c['www'] = dict(port=8010, plugins=dict(waterfall_view={}, console_view={}, grid_view={})) +c['www'] = dict(port=8010, + plugins=dict(waterfall_view={}, + console_view={}, + grid_view={}), + change_hook_dialects={'gitlab' : {'secret': 'sbe7KS9m5Kt-1MxsTKLm',},}, + ) ####### DB URL