summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-08-17 10:11:14 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-08-20 12:25:10 +0100
commitc8efbe23d049578fd17e6e08f8b96bdfbe98189d (patch)
treec9260ca96e0e2caac16bd9d47ac59a3f21bd4bba
parent52b43e8acf9626915c278e371232580af0809222 (diff)
downloadbuildstream-jmac/remote_execution_rebase.tar.gz
element.py: Switch to SandboxRemote if config option is setjmac/remote_execution_rebase
-rw-r--r--buildstream/element.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index cd56eff07..9dee245f3 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -2123,7 +2123,24 @@ class Element(Plugin):
project = self._get_project()
platform = Platform.get_platform()
- if directory is not None and os.path.exists(directory):
+ if self.__remote_execution_url and self.BST_VIRTUAL_DIRECTORY:
+ if not self.__artifacts.has_push_remotes(element=self):
+ # Give an early warning if remote execution will not work
+ raise ElementError("Artifact {} is configured to use remote execution but has no push remotes. "
+ .format(self.name) +
+ "The remote artifact server(s) may not be correctly configured or contactable.")
+
+ self.info("Using a remote 'sandbox' for artifact {}".format(self.name))
+ sandbox = SandboxRemote(context, project,
+ directory,
+ stdout=stdout,
+ stderr=stderr,
+ config=config,
+ server_url=self.__remote_execution_url,
+ allow_real_directory=False)
+ yield sandbox
+ elif directory is not None and os.path.exists(directory):
+ self.info("Using a local sandbox for artifact {}".format(self.name))
sandbox = platform.create_sandbox(context, project,
directory,
stdout=stdout,