mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
build: enable watchdog timer for each build that kills in 2 hours
This introduces locking for the commonly used vagrant functions in vmtools because vagrant fails when another vagrant command is already running.
This commit is contained in:
parent
9a4f3ac019
commit
85985074d4
2 changed files with 37 additions and 12 deletions
|
|
@ -25,6 +25,7 @@ import re
|
|||
import resource
|
||||
import sys
|
||||
import tarfile
|
||||
import threading
|
||||
import traceback
|
||||
import time
|
||||
import requests
|
||||
|
|
@ -978,6 +979,13 @@ def trybuild(app, build, build_dir, output_dir, log_dir, also_check_dir,
|
|||
return True
|
||||
|
||||
|
||||
def force_halt_build():
|
||||
"""Halt the currently running Vagrant VM, to be called from a Timer"""
|
||||
logging.error(_('Force halting build after timeout!'))
|
||||
vm = vmtools.get_build_vm('builder')
|
||||
vm.halt()
|
||||
|
||||
|
||||
def parse_commandline():
|
||||
"""Parse the command line. Returns options, parser."""
|
||||
|
||||
|
|
@ -1143,6 +1151,12 @@ def main():
|
|||
first = True
|
||||
|
||||
for build in app.builds:
|
||||
if options.server: # enable watchdog timer
|
||||
timer = threading.Timer(7200, force_halt_build)
|
||||
timer.start()
|
||||
else:
|
||||
timer = None
|
||||
|
||||
wikilog = None
|
||||
build_starttime = common.get_wiki_timestamp()
|
||||
tools_version_log = ''
|
||||
|
|
@ -1283,6 +1297,9 @@ def main():
|
|||
except Exception as e:
|
||||
logging.error("Error while attempting to publish build log: %s" % e)
|
||||
|
||||
if timer:
|
||||
timer.cancel() # kill the watchdog timer
|
||||
|
||||
for app in build_succeeded:
|
||||
logging.info("success: %s" % (app.id))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue