summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-10-19 16:18:34 +0200
committerJürg Billeter <j@bitron.ch>2020-12-04 16:29:06 +0100
commit802f4f8a3a8f1bce7c888c8c6b7812bf654f401f (patch)
tree10390b8448edae349c8604bafcd351dafe20d7d3
parente17157f81abce4739914ceb4700244324796c8cd (diff)
downloadbuildstream-802f4f8a3a8f1bce7c888c8c6b7812bf654f401f.tar.gz
_context.py: Add support for remote-cache configuration
-rw-r--r--src/buildstream/_context.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index 6578796a3..d3262c0e4 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -31,6 +31,7 @@ from ._artifactcache import ArtifactCache
from ._elementsourcescache import ElementSourcesCache
from ._sourcecache import SourceCache
from ._cas import CASCache, CASLogLevel
+from ._remote import RemoteSpec
from .types import _CacheBuildTrees, _PipelineSelection, _SchedulerErrorAction
from ._workspaces import Workspaces, WorkspaceProjectCache
from .node import Node
@@ -146,6 +147,9 @@ class Context:
# User specified cache quota, used for display messages
self.config_cache_quota_string = None
+ # Remote cache server
+ self.remote_cache_spec = None
+
# Whether or not to attempt to pull build trees globally
self.pull_buildtrees = None
@@ -303,7 +307,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):
@@ -319,6 +323,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_config_node(remote_cache)
+
# Load artifact share configuration
self.artifact_cache_specs = ArtifactCache.specs_from_config_node(defaults)
@@ -531,6 +539,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,
)