buildbot_config/worker/buildbot.tac
Colin Finck b7f59ec24d
[WORKER] Reboot Windows testers after every run of run_rostests
This works by putting the new `buildbot_start.cmd` into Scheduled Tasks (run on logon).
It launches the BuildBot worker and waits for it to finish, then reboots the Windows VM.

The BuildBot worker is reconfigured to watch the `shutdown.stamp` file in the basedir, and ask the Buildmaster for a graceful shutdown of the worker if that file's timestamp has changed.
This works via BuildBot's allow_shutdown Worker config option.

All of this together should gracefully reboot the Windows VM after every test, even when multiple tests are queued and without causing any BuildBot exceptions (which always happen on unexpected shutdowns).

Dedicated to Timo, who asked me about this for months and also found the allow_shutdown option :)
2022-07-13 18:29:08 +02:00

43 lines
1.2 KiB
Python

import os
from buildbot_worker.bot import Worker
from twisted.application import service
basedir = '/srv/buildbot/worker_data'
rotateLength = 10000000
maxRotatedFiles = 10
# if this is a relocatable tac file, get the directory containing the TAC
if basedir == '.':
import os.path
basedir = os.path.abspath(os.path.dirname(__file__))
# note: this line is matched against to check that this is a worker
# directory; do not edit it.
application = service.Application('buildbot-worker')
from twisted.python.logfile import LogFile
from twisted.python.log import ILogObserver, FileLogObserver
logfile = LogFile.fromFullPath(
os.path.join(basedir, "twistd.log"), rotateLength=rotateLength,
maxRotatedFiles=maxRotatedFiles)
application.setComponent(ILogObserver, FileLogObserver(logfile).emit)
buildmaster_host = 'build.reactos.org'
port = 9989
workername = 'WORKERNAME_HERE'
passwd = 'PASSWORD_HERE'
keepalive = 600
umask = 0o22
maxdelay = 300
numcpus = None
allow_shutdown = 'file'
maxretries = None
s = Worker(buildmaster_host, port, workername, passwd, basedir,
keepalive, umask=umask, maxdelay=maxdelay,
numcpus=numcpus, allow_shutdown=allow_shutdown,
maxRetries=maxretries)
s.setServiceParent(application)