]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
handle non-existing build log gracefully and dont delete workspace on failed builds
authorHolger Levsen <holger@layer-acht.org>
Tue, 6 Sep 2011 08:39:57 +0000 (10:39 +0200)
committerHolger Levsen <holger@layer-acht.org>
Tue, 6 Sep 2011 08:39:57 +0000 (10:39 +0200)
build.py

index 82817696fce79633e67e6bd8e1824cd4affdd94b..ed26703a5f260b6f6d122b62ba2b10211232a374 100755 (executable)
--- a/build.py
+++ b/build.py
@@ -214,6 +214,7 @@ def exit_ok():
     sys.exit(0)
 
 def exit_error():
+    atexit.unregister(remove_git_target_workspace)
     send_email(SMTP_BUILD_ERROR)
     sys.exit(1)
 
@@ -406,9 +407,12 @@ if __name__ == '__main__':
     )
     if not ret:
         build_log=os.path.join('../build-area/result/', '%s_%s_amd64.build' % (pkg_name, version))
-        fh = open(build_log, 'r')
-        logger.info('%s' % (fh.read()))
-        fh.close()
+        try:
+          fh = open(build_log, 'r')
+          logger.info('%s' % (fh.read()))
+          fh.close()
+       except:
+         pass
         exit_error()
     else:
         create_dput_cfg()