You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/01/29 23:07:56 UTC

mesos git commit: Updated ReviewBot to tee build output to a file.

Repository: mesos
Updated Branches:
  refs/heads/master c2d0ac5c0 -> 56ebde541


Updated ReviewBot to tee build output to a file.

1) Stream output to the console when build is in progress.
   See https://issues.apache.org/jira/browse/MESOS-1469.

2) Make sure the full build output (and not just truncated build output)
   is output to the console. This was a bug introduced while fixing
   https://issues.apache.org/jira/browse/MESOS-4478.

Review: https://reviews.apache.org/r/42828


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/56ebde54
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/56ebde54
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/56ebde54

Branch: refs/heads/master
Commit: 56ebde5412023e3b32991dbd18f49efcf39dda2c
Parents: c2d0ac5
Author: Vinod Kone <vi...@gmail.com>
Authored: Sat Jan 23 00:07:41 2016 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Jan 29 14:06:17 2016 -0800

----------------------------------------------------------------------
 support/verify_reviews.py | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/56ebde54/support/verify_reviews.py
----------------------------------------------------------------------
diff --git a/support/verify_reviews.py b/support/verify_reviews.py
index 251d57e..0e76620 100755
--- a/support/verify_reviews.py
+++ b/support/verify_reviews.py
@@ -119,6 +119,8 @@ def cleanup():
 
 def verify_review(review_request):
     print "Verifying review %s" % review_request["id"]
+    build_output = "build_" + str(review_request["id"])
+
     try:
         # Recursively apply the review and its dependents.
         applied = []
@@ -131,7 +133,12 @@ def verify_review(review_request):
         configuration = "export OS=ubuntu:14.04;export CONFIGURATION=\"--verbose\";export COMPILER=gcc"
         command = "%s; ./support/docker_build.sh" % configuration
 
-        shell(command)
+
+        # `tee` the output so that the console can log the whole build output.
+        # `pipefail` ensures that the exit status of the build command is
+        # preserved even after tee'ing.
+        subprocess.check_call(['bash', '-c', 'set -o pipefail; %s 2>&1 | tee %s'
+                               % (command, build_output)])
 
         # Success!
         post_review(
@@ -140,8 +147,13 @@ def verify_review(review_request):
             "Reviews applied: %s\n\n" \
             "Passed command: %s" % (applied, command))
     except subprocess.CalledProcessError as e:
-        # Truncate the output as it can be very large.
-        output = "...<truncated>...\n" + e.output[-REVIEW_SIZE:]
+        # If we are here because the docker build command failed, read the
+        # output from `build_output` file. For all other command failures read
+        # the output from `e.output`.
+        output = open(build_output).read() if os.path.exists(build_output) else e.output
+
+        # Truncate the output when posting the review as it can be very large.
+        output = output if len(output) <= REVIEW_SIZE else "...<truncated>...\n" + output[-REVIEW_SIZE:]
         output = output + "\nFull log: " + os.path.join(os.environ['BUILD_URL'], 'console')
 
         post_review(
@@ -149,13 +161,13 @@ def verify_review(review_request):
             "Bad patch!\n\n" \
             "Reviews applied: %s\n\n" \
             "Failed command: %s\n\n" \
-            "Error:\n %s" % (applied, e.cmd, output))
+            "Error:\n%s" % (applied, e.cmd, output))
     except ReviewError as e:
         post_review(
             review_request,
             "Bad review!\n\n" \
             "Reviews applied: %s\n\n" \
-            "Error:\n %s" % (applied, e.args[0]))
+            "Error:\n%s" % (applied, e.args[0]))
 
     # Clean up.
     cleanup()