From 7744b86e9c7950da62e87bfff3967c67477a1620 Mon Sep 17 00:00:00 2001 From: olaola Date: Mon, 18 Sep 2017 23:04:33 +0200 Subject: Uploading failed action outputs to the remote cache, because even if the tests fails, we still want to be able to download the logs and other outputs from CAS. This fixes a bug introduced by https://github.com/bazelbuild/bazel/commit/562fcf9f5dfd14daea718f77da95b43b1400689b. To reproduce: run a failing test vs a BES service, the test log would not be uploaded. TESTED=unit tests PiperOrigin-RevId: 169143428 --- .../build/lib/remote/SimpleBlobStoreActionCache.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java') diff --git a/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java b/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java index 6fef48f178..0a435fabed 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java +++ b/src/main/java/com/google/devtools/build/lib/remote/SimpleBlobStoreActionCache.java @@ -170,8 +170,12 @@ public final class SimpleBlobStoreActionCache implements RemoteActionCache { @Override public void upload( - ActionKey actionKey, Path execRoot, Collection files, FileOutErr outErr) - throws IOException, InterruptedException { + ActionKey actionKey, + Path execRoot, + Collection files, + FileOutErr outErr, + boolean uploadAction) + throws IOException, InterruptedException { ActionResult.Builder result = ActionResult.newBuilder(); upload(result, execRoot, files); if (outErr.getErrorPath().exists()) { @@ -182,8 +186,10 @@ public final class SimpleBlobStoreActionCache implements RemoteActionCache { Digest stdout = uploadFileContents(outErr.getOutputPath()); result.setStdoutDigest(stdout); } - blobStore.putActionResult( - actionKey.getDigest().getHash(), new ByteArrayInputStream(result.build().toByteArray())); + if (uploadAction) { + blobStore.putActionResult( + actionKey.getDigest().getHash(), new ByteArrayInputStream(result.build().toByteArray())); + } } public void upload(ActionResult.Builder result, Path execRoot, Collection files) -- cgit v1.2.3