You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2021/05/20 08:09:33 UTC
[buildstream] 08/14: _context.py: Add support for remote-cache
configuration
This is an automated email from the ASF dual-hosted git repository.
juergbi pushed a commit to branch juerg/remote-cache-ci
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 977180ae3cca4d636599c82df27a7e5cac8f452d
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Mon Oct 19 16:18:34 2020 +0200
_context.py: Add support for remote-cache configuration
---
src/buildstream/_context.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index d5d0669..8c409ec 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -175,6 +175,9 @@ class Context:
# User specified cache quota, used for display messages
self.config_cache_quota_string: Optional[str] = None
+ # Remote cache server
+ self.remote_cache_spec: Optional[RemoteSpec] = None
+
# Whether or not to attempt to pull build trees globally
self.pull_buildtrees: Optional[bool] = None
@@ -343,7 +346,7 @@ class Context:
# We need to find the first existing directory in the path of our
# casdir - the casdir may not have been created yet.
cache = defaults.get_mapping("cache")
- cache.validate_keys(["quota", "pull-buildtrees", "cache-buildtrees"])
+ cache.validate_keys(["quota", "remote-cache", "pull-buildtrees", "cache-buildtrees"])
cas_volume = self.casdir
while not os.path.exists(cas_volume):
@@ -359,6 +362,10 @@ class Context:
LoadErrorReason.INVALID_DATA,
) from e
+ remote_cache = cache.get_mapping("remote-cache", default=None)
+ if remote_cache:
+ self.remote_cache_spec = RemoteSpec.new_from_node(remote_cache)
+
# Load global artifact cache configuration
cache_config = defaults.get_mapping("artifacts", default={})
self._global_artifact_cache_config = _CacheConfig.new_from_node(cache_config)
@@ -661,6 +668,7 @@ class Context:
self.cachedir,
casd=self.use_casd,
cache_quota=self.config_cache_quota,
+ remote_cache_spec=self.remote_cache_spec,
log_level=log_level,
log_directory=self.logdir,
)