mirror of
https://github.com/reactos/buildbot_config.git
synced 2024-11-23 03:39:51 +00:00
b7f59ec24d
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 :)
43 lines
1.2 KiB
Python
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)
|