from buildbot.plugins import changes, reporters, schedulers, secrets, steps, util, worker
from buildbot.changes.filter import ChangeFilter
from buildbot.changes.gitpoller import GitPoller
+from buildbot.changes.pb import PBChangeSource
from buildbot.config.builder import BuilderConfig
from buildbot.steps.source.git import Git
from buildbot.steps.shell import ShellCommand
####### CHANGESOURCES
c['change_source'] = []
+
+c['change_source'].append(PBChangeSource(
+ port=9444,
+ user="local-post-receive",
+ passwd=Secret("local-post-receive.pass")))
c['change_source'].append(GitPoller(
'https://framagit.org/medoc92/npupnp.git',
project='npupnp',
workernames=["carbon-worker"],
factory=factory))
+####### hook-test
+
+localrepo='/usr/src/bare/hook-test.git'
+c['schedulers'].append(SingleBranchScheduler(
+ name="hook-test",
+ change_filter=ChangeFilter(project="hook-test"),
+ treeStableTimer=None,
+ builderNames=["hook-test"]))
+factory = BuildFactory()
+factory.addStep(Git(repourl='lin0:'+localrepo,branch='main'))
+factory.addStep(ShellCommand(
+ name="echo something",
+ command=["echo","hello"],
+ haltOnFailure=True))
+c['builders'].append(BuilderConfig(
+ name="hook-test",
+ tags=["hook-test"],
+ workernames=["carbon-worker"],
+ factory=factory))
+
####### PROJECT IDENTITY
c['title'] = "Humopery CI"
--- /dev/null
+#!/bin/bash
+
+# To prepare a git hook:
+# - copy this file into the bare repo's hooks dir (with +x)
+# - 'pip install future' within the venv
+# - adjust paths below, if using from some other machine
+# - set --auth below to the real password
+
+# PBChangeSource doc: https://docs.buildbot.net/current/manual/configuration/changesources.html#pbchangesource
+# The doc makes it sound like the worker port (9989 TLS) must be used but it doesn't work
+# This method doesn't use TLS so not very secure. I think git_buildbot.py just doesn't support TLS
+
+# Note the same PBChangeSource can be used for:
+# buildbot sendchange --project foo --master 127.0.0.1:9444 --auth local-post-receive:XXXXXXXXXXX --who erik
+
+source /var/lib/buildmaster/src/buildbot/.venvpython3/bin/activate
+# echo $VIRTUAL_ENV
+# echo $PATH
+# while read line; do echo $line; done
+
+export GIT_DIR
+
+exec /var/lib/buildmaster/src/buildbot/master/contrib/git_buildbot.py \
+ --master bb.humopery.space:9444 \
+ --username local-post-receive \
+ --auth XXXXXXXXXXXXXXXX \
+ --project hook-test