customize

This commit is contained in:
AF 2023-08-04 19:37:18 +00:00
parent 1defda446b
commit 624b3ed609
3 changed files with 73 additions and 53 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/venv
gitea.env

View File

@ -12,55 +12,64 @@ from buildbot.plugins import *
# a shorter alias to save typing. # a shorter alias to save typing.
c = BuildmasterConfig = {} c = BuildmasterConfig = {}
GITEA_SECRET = os.environ.get("GITEA_SECRET")
####### WORKERS ####### WORKERS
# The 'workers' list defines the set of recognized workers. Each element is # The 'workers' list defines the set of recognized workers. Each element is
# a Worker object, specifying a unique worker name and password. The same # a Worker object, specifying a unique worker name and password. The same
# worker name and password must be configured on the worker. # worker name and password must be configured on the worker.
c['workers'] = [worker.Worker("example-worker", 'pass')] c["workers"] = [worker.Worker("example-worker", "pass")]
if 'BUILDBOT_MQ_URL' in os.environ: if "BUILDBOT_MQ_URL" in os.environ:
c['mq'] = { c["mq"] = {
'type' : 'wamp', "type": "wamp",
'router_url': os.environ['BUILDBOT_MQ_URL'], "router_url": os.environ["BUILDBOT_MQ_URL"],
'realm': os.environ.get('BUILDBOT_MQ_REALM', 'buildbot').decode('utf-8'), "realm": os.environ.get("BUILDBOT_MQ_REALM", "buildbot").decode("utf-8"),
'debug' : 'BUILDBOT_MQ_DEBUG' in os.environ, "debug": "BUILDBOT_MQ_DEBUG" in os.environ,
'debug_websockets' : 'BUILDBOT_MQ_DEBUG' in os.environ, "debug_websockets": "BUILDBOT_MQ_DEBUG" in os.environ,
'debug_lowlevel' : 'BUILDBOT_MQ_DEBUG' in os.environ, "debug_lowlevel": "BUILDBOT_MQ_DEBUG" in os.environ,
} }
# 'protocols' contains information about protocols which master will use for # 'protocols' contains information about protocols which master will use for
# communicating with workers. You must define at least 'port' option that workers # communicating with workers. You must define at least 'port' option that workers
# could connect to your master with this protocol. # could connect to your master with this protocol.
# 'port' must match the value configured into the workers (with their # 'port' must match the value configured into the workers (with their
# --master option) # --master option)
c['protocols'] = {'pb': {'port': os.environ.get("BUILDBOT_WORKER_PORT", 9989)}} c["protocols"] = {"pb": {"port": os.environ.get("BUILDBOT_WORKER_PORT", 9989)}}
####### CHANGESOURCES ####### CHANGESOURCES
# the 'change_source' setting tells the buildmaster how it should find out # the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Here we point to the buildbot clone of radn. # about source code changes. Here we point to the buildbot clone of radn.
c['change_source'] = [] c["change_source"] = []
c['change_source'].append(changes.GitPoller( c["change_source"].append(
'https://gitea.parrrate.ru/PTV/radn-rs.git', changes.GitPoller(
workdir='gitpoller-workdir', branch='main', "https://gitea.parrrate.ru/PTV/radn-rs.git",
pollinterval=10)) workdir="gitpoller-workdir",
branch="main",
pollinterval=10,
)
)
####### SCHEDULERS ####### SCHEDULERS
# Configure the Schedulers, which decide how to react to incoming changes. In this # Configure the Schedulers, which decide how to react to incoming changes. In this
# case, just kick off a 'runtests' build # case, just kick off a 'runtests' build
c['schedulers'] = [] c["schedulers"] = []
c['schedulers'].append(schedulers.SingleBranchScheduler( c["schedulers"].append(
name="all", schedulers.SingleBranchScheduler(
change_filter=util.ChangeFilter(branch='main'), name="all",
treeStableTimer=None, change_filter=util.ChangeFilter(branch="main"),
builderNames=["runtests"])) treeStableTimer=None,
c['schedulers'].append(schedulers.ForceScheduler( builderNames=["runtests"],
name="force", )
builderNames=["runtests"])) )
c["schedulers"].append(
schedulers.ForceScheduler(name="force", builderNames=["runtests"])
)
####### BUILDERS ####### BUILDERS
@ -70,16 +79,25 @@ c['schedulers'].append(schedulers.ForceScheduler(
factory = util.BuildFactory() factory = util.BuildFactory()
# check out the source # check out the source
factory.addStep(steps.Git(repourl='https://gitea.parrrate.ru/PTV/radn-rs.git', mode='incremental')) if GITEA_SECRET:
# factory.addStep(steps.Gitea(repourl='https://gitea.parrrate.ru/PTV/radn-rs.git', mode='incremental')) factory.addStep(
steps.Gitea(
repourl="https://gitea.parrrate.ru/PTV/radn-rs.git", mode="incremental"
)
)
else:
factory.addStep(
steps.Git(
repourl="https://gitea.parrrate.ru/PTV/radn-rs.git", mode="incremental"
)
)
# run the tests (note that this will require that 'trial' is installed) # run the tests (note that this will require that 'trial' is installed)
factory.addStep(steps.ShellCommand(command=["cargo", "test"])) factory.addStep(steps.ShellCommand(command=["cargo", "test"]))
c['builders'] = [] c["builders"] = []
c['builders'].append( c["builders"].append(
util.BuilderConfig(name="runtests", util.BuilderConfig(name="runtests", workernames=["example-worker"], factory=factory)
workernames=["example-worker"], )
factory=factory))
####### REPORTER TARGETS ####### REPORTER TARGETS
@ -87,48 +105,47 @@ c['builders'].append(
# pushed to these targets. buildbot/reporters/*.py has a variety to choose from, # pushed to these targets. buildbot/reporters/*.py has a variety to choose from,
# like IRC bots. # like IRC bots.
c['services'] = [ c["services"] = []
# reporters.GiteaStatusPush('https://example.com', "SECRET", verbose=True),
]
####### PROJECT IDENTITY ####### PROJECT IDENTITY
# the 'title' string will appear at the top of this buildbot installation's # the 'title' string will appear at the top of this buildbot installation's
# home pages (linked to the 'titleURL'). # home pages (linked to the 'titleURL').
c['title'] = "RADN" c["title"] = "RADN"
c['titleURL'] = "https://gitea.parrrate.ru/PTV/radn-rs" c["titleURL"] = "https://gitea.parrrate.ru/PTV/radn-rs"
# the 'buildbotURL' string should point to the location where the buildbot's # the 'buildbotURL' string should point to the location where the buildbot's
# internal web server is visible. This typically uses the port number set in # internal web server is visible. This typically uses the port number set in
# the 'www' entry below, but with an externally-visible host name which the # the 'www' entry below, but with an externally-visible host name which the
# buildbot cannot figure out without some help. # buildbot cannot figure out without some help.
c['buildbotURL'] = os.environ.get("BUILDBOT_WEB_URL", "http://localhost:8010/") c["buildbotURL"] = os.environ.get("BUILDBOT_WEB_URL", "http://localhost:8010/")
# minimalistic config to activate new web UI # minimalistic config to activate new web UI
c['www'] = dict(port=os.environ.get("BUILDBOT_WEB_PORT", 8010), c["www"] = {
plugins=dict(waterfall_view={}, console_view={})) "port": os.environ.get("BUILDBOT_WEB_PORT", 8010),
c['www'] = { "plugins": {
'port': os.environ.get("BUILDBOT_WEB_PORT", 8010), "waterfall_view": {},
'plugins': { "console_view": {},
'waterfall_view': {},
'console_view': {},
}, },
# 'change_hook_dialects': { "change_hook_dialects": {},
# 'gitea': {
# 'secret': '<SecretToEnterInGitea>',
# 'onlyIncludePushCommit': True,
# }
# },
} }
if GITEA_SECRET:
c["www"]["change_hook_dialects"]["gitea"] = {
"secret": GITEA_SECRET,
"onlyIncludePushCommit": True,
}
c["services"].append(
reporters.GiteaStatusPush("https://example.com", GITEA_SECRET, verbose=True),
)
####### DB URL ####### DB URL
c['db'] = { c["db"] = {
# This specifies what database buildbot uses to store its state. You can leave # This specifies what database buildbot uses to store its state. You can leave
# this at its default for all but the largest installations. # this at its default for all but the largest installations.
'db_url' : os.environ.get("BUILDBOT_DB_URL", "sqlite://").format(**os.environ), "db_url": os.environ.get("BUILDBOT_DB_URL", "sqlite://").format(**os.environ),
} }
c['buildbotNetUsageData'] = None c["buildbotNetUsageData"] = None

View File

@ -5,6 +5,7 @@ services:
build: ../master build: ../master
env_file: env_file:
- db.env - db.env
- gitea.env
environment: environment:
- BUILDBOT_CONFIG_DIR=config - BUILDBOT_CONFIG_DIR=config
- BUILDBOT_CONFIG_URL=https://gitea.parrrate.ru/PTV/buildabot/archive/master.tar.gz - BUILDBOT_CONFIG_URL=https://gitea.parrrate.ru/PTV/buildabot/archive/master.tar.gz