summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Blanchard <martin.blanchard@codethink.co.uk>2018-09-24 14:39:29 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-09-27 09:46:27 +0100
commit16cf9d5f6c2b05fbf770a9194c0cee531f5bc2f9 (patch)
tree2190c2a4e8a37e6919aec2d1e3d1b66db22554a4
parent0f2bc375427a624603272d0061799df8f536a012 (diff)
downloadbuildstream-mablanch/668-remote-build-failure.tar.gz
_sandboxremote.py: Handle remote build execution exit codemablanch/668-remote-build-failure
https://gitlab.com/BuildStream/buildstream/issues/668
-rw-r--r--buildstream/sandbox/_sandboxremote.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/buildstream/sandbox/_sandboxremote.py b/buildstream/sandbox/_sandboxremote.py
index 2fca53a96..6a49ec4bb 100644
--- a/buildstream/sandbox/_sandboxremote.py
+++ b/buildstream/sandbox/_sandboxremote.py
@@ -27,6 +27,7 @@ from . import Sandbox
from ..storage._filebaseddirectory import FileBasedDirectory
from ..storage._casbaseddirectory import CasBasedDirectory
from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
+from .._protos.google.rpc import code_pb2
from .._platform import Platform
@@ -207,15 +208,23 @@ class SandboxRemote(Sandbox):
operation.response.Unpack(execution_response)
- if execution_response.status.code != 0:
- # A normal error during the build: the remote execution system
- # has worked correctly but the command failed.
- # execution_response.error also contains 'message' (str) and
- # 'details' (iterator of Any) which we ignore at the moment.
- return execution_response.status.code
+ if execution_response.status.code != code_pb2.OK:
+ # An unexpected error during execution: the remote execution
+ # system failed at processing the execution request.
+ if execution_response.status.message:
+ raise SandboxError(execution_response.status.message)
+ else:
+ raise SandboxError("Remote server failed at executing the build request.")
action_result = execution_response.result
+ if action_result.exit_code != 0:
+ # A normal error during the build: the remote execution system
+ # has worked correctly but the command failed.
+ # action_result.stdout and action_result.stderr also contains
+ # build command outputs which we ignore at the moment.
+ return action_result.exit_code
+
self.process_job_output(action_result.output_directories, action_result.output_files)
return 0