mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-09 00:40:11 +01:00
Buildserver snapshot refinements
This commit is contained in:
parent
448fa61d0c
commit
cdfa020ba7
@ -49,6 +49,11 @@ def build_server(app, thisbuild, build_dir, output_dir):
|
||||
output = p.communicate()[0]
|
||||
if output.find('fdroidclean') != -1:
|
||||
print "...snapshot exists - resetting build server to clean state"
|
||||
p = subprocess.Popen(['vagrant', 'status'],
|
||||
cwd='builder', stdout=subprocess.PIPE)
|
||||
output = p.communicate()[0]
|
||||
if output.find('running') != -1:
|
||||
print "...suspending"
|
||||
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
||||
if subprocess.call(['vagrant', 'snap', 'go', 'fdroidclean'],
|
||||
cwd='builder') == 0:
|
||||
@ -89,7 +94,10 @@ def build_server(app, thisbuild, build_dir, output_dir):
|
||||
if output.find('fdroidclean') == -1:
|
||||
raise BuildException("Failed to take snapshot.")
|
||||
|
||||
try:
|
||||
|
||||
# Get SSH configuration settings for us to connect...
|
||||
print "Getting ssh configuration..."
|
||||
subprocess.call('vagrant ssh-config >sshconfig',
|
||||
cwd='builder', shell=True)
|
||||
vagranthost = 'default' # Host in ssh config file
|
||||
@ -102,6 +110,7 @@ def build_server(app, thisbuild, build_dir, output_dir):
|
||||
sshconfig = sshconfig.lookup(vagranthost)
|
||||
|
||||
# Open SSH connection...
|
||||
print "Connecting to virtual machine..."
|
||||
sshs = ssh.SSHClient()
|
||||
sshs.set_missing_host_key_policy(ssh.AutoAddPolicy())
|
||||
sshs.connect(sshconfig['hostname'], username=sshconfig['user'],
|
||||
@ -126,6 +135,7 @@ def build_server(app, thisbuild, build_dir, output_dir):
|
||||
for dd in d:
|
||||
ftp.mkdir(dd)
|
||||
for ff in f:
|
||||
if not os.path.islink(os.path.join(root, rr, ff)):
|
||||
ftp.put(os.path.join(root, rr, ff), ff)
|
||||
for i in range(len(rr.split('/'))):
|
||||
ftp.chdir('..')
|
||||
@ -203,7 +213,9 @@ def build_server(app, thisbuild, build_dir, output_dir):
|
||||
raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
|
||||
ftp.close()
|
||||
|
||||
# Suspend the buildserver...
|
||||
finally:
|
||||
|
||||
# Suspend the build server.
|
||||
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
||||
|
||||
|
||||
|
@ -2,12 +2,9 @@
|
||||
set -e
|
||||
rm -f buildserver.box
|
||||
cd buildserver
|
||||
vagrant halt
|
||||
vagrant up
|
||||
sleep 5
|
||||
vagrant ssh -c "sudo shutdown -h now"
|
||||
cd ..
|
||||
# Just to wait until it's shut down!
|
||||
sleep 20
|
||||
vagrant halt
|
||||
vagrant package --base `VBoxManage list vms | grep buildserver | sed 's/"\(.*\)".*/\1/'` --output buildserver.box
|
||||
vagrant box add buildserver buildserver.box -f && rm buildserver.box
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user