summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2019-08-01 10:12:37 +0200
committerHelmut Grohne <helmut@subdivi.de>2019-08-01 10:12:37 +0200
commitf93b427b821a0ee9021ea3ddf02894eccb669f2c (patch)
tree7c8d53baa2c996a8648431670104716bd17debc4
parent330fe08852dd954f60f17fa04a06d00d3a15be74 (diff)
downloadcrossqa-f93b427b821a0ee9021ea3ddf02894eccb669f2c.tar.gz
build.py: handle errors from ssh in a better way
Previously, it would retry immediately and produce empty log files marked as failures. When ssh fails, we no longer record a build nor log. We also wait a little before retrying.
-rwxr-xr-xbuild.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/build.py b/build.py
index 3ede7f1..3312bd0 100755
--- a/build.py
+++ b/build.py
@@ -31,12 +31,17 @@ def do_build(source, version, architecture, server):
now.strftime("%Y%m%d%H%M%S"))
cmdline = ["ssh", server, "sh", "/dev/stdin", architecture,
"%s_%s" % (source, version)]
- with open(os.path.join("logs", logtarget), "w+b") as output:
+ logname = os.path.join("logs", logtarget)
+ with open(logname, "w+b") as output:
with open("build.sh", "rb") as instructions:
code = subprocess.call(cmdline, stdin=instructions, stdout=output)
output.seek(0)
status = scan_log_status(output)
- print("status %s code %d" % (status, code))
+ if code == 255:
+ os.unlink(logname)
+ time.sleep(300)
+ raise RuntimeError("ssh failed")
+ print("status %s code %d" % (status, code))
return (now, code == 0, logtarget, status == "given-back")
def main():