mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-19 21:30:10 +01:00
build: destroy vm after each build
This commit is contained in:
parent
3e35b2dd27
commit
5485869e3f
@ -74,7 +74,7 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
|
|||||||
else:
|
else:
|
||||||
logging.getLogger("paramiko").setLevel(logging.WARN)
|
logging.getLogger("paramiko").setLevel(logging.WARN)
|
||||||
|
|
||||||
sshinfo = vmtools.get_clean_builder('builder', options.reset_server)
|
sshinfo = vmtools.get_clean_builder('builder')
|
||||||
|
|
||||||
output = None
|
output = None
|
||||||
try:
|
try:
|
||||||
@ -295,7 +295,8 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
|
|||||||
finally:
|
finally:
|
||||||
# Suspend the build server.
|
# Suspend the build server.
|
||||||
vm = vmtools.get_build_vm('builder')
|
vm = vmtools.get_build_vm('builder')
|
||||||
vm.suspend()
|
logging.info('destroying buildserver after build')
|
||||||
|
vm.destroy()
|
||||||
|
|
||||||
# deploy logfile to repository web server
|
# deploy logfile to repository web server
|
||||||
if output:
|
if output:
|
||||||
|
@ -33,7 +33,7 @@ import threading
|
|||||||
lock = threading.Lock()
|
lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
def get_clean_builder(serverdir, reset=False):
|
def get_clean_builder(serverdir):
|
||||||
if not os.path.isdir(serverdir):
|
if not os.path.isdir(serverdir):
|
||||||
if os.path.islink(serverdir):
|
if os.path.islink(serverdir):
|
||||||
os.unlink(serverdir)
|
os.unlink(serverdir)
|
||||||
@ -51,26 +51,9 @@ def get_clean_builder(serverdir, reset=False):
|
|||||||
end
|
end
|
||||||
"""))
|
"""))
|
||||||
vm = get_build_vm(serverdir)
|
vm = get_build_vm(serverdir)
|
||||||
if reset:
|
logging.info('destroying buildserver before build')
|
||||||
logging.info('resetting buildserver by request')
|
|
||||||
elif not vm.vagrant_uuid_okay():
|
|
||||||
logging.info('resetting buildserver, because vagrant vm is not okay.')
|
|
||||||
reset = True
|
|
||||||
elif not vm.snapshot_exists('fdroidclean'):
|
|
||||||
logging.info("resetting buildserver, because snapshot 'fdroidclean' is not present.")
|
|
||||||
reset = True
|
|
||||||
|
|
||||||
if reset:
|
|
||||||
vm.destroy()
|
vm.destroy()
|
||||||
vm.up()
|
logging.info('starting buildserver')
|
||||||
vm.suspend()
|
|
||||||
|
|
||||||
if reset:
|
|
||||||
logging.info('buildserver recreated: taking a clean snapshot')
|
|
||||||
vm.snapshot_create('fdroidclean')
|
|
||||||
else:
|
|
||||||
logging.info('builserver ok: reverting to clean snapshot')
|
|
||||||
vm.snapshot_revert('fdroidclean')
|
|
||||||
vm.up()
|
vm.up()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user