mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 07:20:29 +03:00
More buildserver snapshot stability tweaks (possibly voodoo)
This commit is contained in:
parent
3f00d04836
commit
9cf282fdc1
1 changed files with 21 additions and 12 deletions
|
|
@ -57,8 +57,8 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path):
|
||||||
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:
|
||||||
if subprocess.call(['vagrant', 'up'], cwd='builder') != 0:
|
#if subprocess.call(['vagrant', 'up'], cwd='builder') != 0:
|
||||||
raise BuildException("Failed to start build server")
|
# raise BuildException("Failed to start build server")
|
||||||
print "...reset to snapshot - server is valid"
|
print "...reset to snapshot - server is valid"
|
||||||
vm_ok = True
|
vm_ok = True
|
||||||
else:
|
else:
|
||||||
|
|
@ -97,8 +97,9 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path):
|
||||||
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'],
|
||||||
port=int(sshconfig['port']), timeout=60, look_for_keys=False,
|
port=int(sshconfig['port']), timeout=300, look_for_keys=False,
|
||||||
key_filename=sshconfig['identityfile'])
|
key_filename=sshconfig['identityfile'])
|
||||||
|
sshs.close()
|
||||||
|
|
||||||
print "Saving clean state of new build server"
|
print "Saving clean state of new build server"
|
||||||
if subprocess.call(['vagrant', 'snap', 'take', '-n', 'fdroidclean'],
|
if subprocess.call(['vagrant', 'snap', 'take', '-n', 'fdroidclean'],
|
||||||
|
|
@ -134,7 +135,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path):
|
||||||
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'],
|
||||||
port=int(sshconfig['port']), timeout=60, look_for_keys=False,
|
port=int(sshconfig['port']), timeout=300, look_for_keys=False,
|
||||||
key_filename=sshconfig['identityfile'])
|
key_filename=sshconfig['identityfile'])
|
||||||
|
|
||||||
# Get an SFTP connection...
|
# Get an SFTP connection...
|
||||||
|
|
@ -214,13 +215,16 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path):
|
||||||
# Execute the build script...
|
# Execute the build script...
|
||||||
print "Starting build..."
|
print "Starting build..."
|
||||||
chan = sshs.get_transport().open_session()
|
chan = sshs.get_transport().open_session()
|
||||||
stdoutf = chan.makefile('rb')
|
stdoutf = chan.makefile('r')
|
||||||
stderrf = chan.makefile_stderr('rb')
|
stderrf = chan.makefile_stderr('r')
|
||||||
chan.exec_command('python build.py --on-server -p ' +
|
chan.exec_command('python build.py --on-server -p ' +
|
||||||
app['id'] + ' --vercode ' + thisbuild['vercode'])
|
app['id'] + ' --vercode ' + thisbuild['vercode'])
|
||||||
|
output = ''
|
||||||
|
error = ''
|
||||||
|
while not chan.exit_status_ready():
|
||||||
|
output += stdoutf.read()
|
||||||
|
error += stderrf.read()
|
||||||
returncode = chan.recv_exit_status()
|
returncode = chan.recv_exit_status()
|
||||||
output = stdoutf.read()
|
|
||||||
error = stderrf.read()
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
raise BuildException("Build.py failed on server for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
|
raise BuildException("Build.py failed on server for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
|
||||||
|
|
||||||
|
|
@ -238,6 +242,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path):
|
||||||
finally:
|
finally:
|
||||||
|
|
||||||
# Suspend the build server.
|
# Suspend the build server.
|
||||||
|
print "Suspending build server"
|
||||||
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -566,21 +571,24 @@ def main():
|
||||||
options.install, options.force, options.verbose):
|
options.install, options.force, options.verbose):
|
||||||
build_succeeded.append(app)
|
build_succeeded.append(app)
|
||||||
except BuildException as be:
|
except BuildException as be:
|
||||||
|
logfile = open(os.path.join(log_dir, app['id'] + '.log'), 'a+')
|
||||||
|
logfile.write(str(be))
|
||||||
|
logfile.close()
|
||||||
if options.stop:
|
if options.stop:
|
||||||
raise
|
sys.exit(1)
|
||||||
print "Could not build app %s due to BuildException: %s" % (app['id'], be)
|
print "Could not build app %s due to BuildException: %s" % (app['id'], be)
|
||||||
logfile = open(os.path.join(log_dir, app['id'] + '.log'), 'a+')
|
logfile = open(os.path.join(log_dir, app['id'] + '.log'), 'a+')
|
||||||
logfile.write(str(be))
|
logfile.write(str(be))
|
||||||
logfile.close
|
logfile.close()
|
||||||
failed_apps[app['id']] = be
|
failed_apps[app['id']] = be
|
||||||
except VCSException as vcse:
|
except VCSException as vcse:
|
||||||
if options.stop:
|
if options.stop:
|
||||||
raise
|
sys.exit(1)
|
||||||
print "VCS error while building app %s: %s" % (app['id'], vcse)
|
print "VCS error while building app %s: %s" % (app['id'], vcse)
|
||||||
failed_apps[app['id']] = vcse
|
failed_apps[app['id']] = vcse
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if options.stop:
|
if options.stop:
|
||||||
raise
|
sys.exit(1)
|
||||||
print "Could not build app %s due to unknown error: %s" % (app['id'], traceback.format_exc())
|
print "Could not build app %s due to unknown error: %s" % (app['id'], traceback.format_exc())
|
||||||
failed_apps[app['id']] = e
|
failed_apps[app['id']] = e
|
||||||
|
|
||||||
|
|
@ -596,6 +604,7 @@ def main():
|
||||||
if len(failed_apps) > 0:
|
if len(failed_apps) > 0:
|
||||||
print str(len(failed_apps)) + ' builds failed'
|
print str(len(failed_apps)) + ' builds failed'
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue