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