pipeline: delay cleanup of build tree

Delay the cleanup of the build tree of the build pipeline, and
first check the result and only cleanup the tree when the build
did not fail, because in that case both returned trees will be
None and trying to cleanup them up will result in an exception.
Therefore, also don't clean up `tree` in the error case.
This commit is contained in:
Christian Kellner 2020-03-21 13:02:36 +01:00 committed by David Rheinsberg
parent 67dfe0965e
commit 08fc223276

View file

@ -232,16 +232,16 @@ class Pipeline:
interactive,
libdir,
secrets)
# Cleanup the build tree used to build `tree`
# which is not needed anymore
t.cleanup()
results["build"] = r
if not r["success"]:
tree.cleanup()
results["success"] = False
return results, None, None
# Cleanup the build tree (`t`) which was used to
# build `tree`; it is now not needed anymore
t.cleanup()
build_tree = tree
# Create a new tree. The base is our tree_id because if that