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:
|
||||
logging.getLogger("paramiko").setLevel(logging.WARN)
|
||||
|
||||
sshinfo = vmtools.get_clean_builder('builder', options.reset_server)
|
||||
sshinfo = vmtools.get_clean_builder('builder')
|
||||
|
||||
output = None
|
||||
try:
|
||||
@ -295,7 +295,8 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
|
||||
finally:
|
||||
# Suspend the build server.
|
||||
vm = vmtools.get_build_vm('builder')
|
||||
vm.suspend()
|
||||
logging.info('destroying buildserver after build')
|
||||
vm.destroy()
|
||||
|
||||
# deploy logfile to repository web server
|
||||
if output:
|
||||
|
@ -33,7 +33,7 @@ import threading
|
||||
lock = threading.Lock()
|
||||
|
||||
|
||||
def get_clean_builder(serverdir, reset=False):
|
||||
def get_clean_builder(serverdir):
|
||||
if not os.path.isdir(serverdir):
|
||||
if os.path.islink(serverdir):
|
||||
os.unlink(serverdir)
|
||||
@ -51,26 +51,9 @@ def get_clean_builder(serverdir, reset=False):
|
||||
end
|
||||
"""))
|
||||
vm = get_build_vm(serverdir)
|
||||
if reset:
|
||||
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.up()
|
||||
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')
|
||||
logging.info('destroying buildserver before build')
|
||||
vm.destroy()
|
||||
logging.info('starting buildserver')
|
||||
vm.up()
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user