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 2025/06/13 15:28:03 UTC

(buildstream) branch jbilleter/action-cache-service created (now c26c43dbe)

This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a change to branch jbilleter/action-cache-service
in repository https://gitbox.apache.org/repos/asf/buildstream.git


      at c26c43dbe Add `action-cache-service` support

This branch includes the following new commits:

     new c26c43dbe Add `action-cache-service` support

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(buildstream) 01/01: Add `action-cache-service` support

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch jbilleter/action-cache-service
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c26c43dbe4a355c662728f87c300d562081d02f0
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Jun 13 17:25:13 2025 +0200

    Add `action-cache-service` support
---
 src/buildstream/_cas/casdprocessmanager.py     | 26 ++++++++++++++++++++++++++
 src/buildstream/_context.py                    | 23 ++++++++++++++++++++++-
 src/buildstream/_frontend/widget.py            |  2 ++
 src/buildstream/sandbox/_sandboxbuildboxrun.py |  6 ++++--
 4 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/src/buildstream/_cas/casdprocessmanager.py b/src/buildstream/_cas/casdprocessmanager.py
index fd1692d9f..50a89124c 100644
--- a/src/buildstream/_cas/casdprocessmanager.py
+++ b/src/buildstream/_cas/casdprocessmanager.py
@@ -61,6 +61,7 @@ _REQUIRED_CASD_MICRO = 0
 #     cache_quota (int): User configured cache quota
 #     reserved (int): User configured reserved disk space
 #     remote_cache_spec (RemoteSpec): Optional remote cache server
+#     remote_action_cache_spec (RemoteSpec): Optional remote action cache server
 #     protect_session_blobs (bool): Disable expiry for blobs used in the current session
 #     messenger (Messenger): The messenger to report warnings through the UI
 #
@@ -72,6 +73,7 @@ class CASDProcessManager:
         log_level,
         cache_quota,
         remote_cache_spec,
+        remote_action_cache_spec,
         protect_session_blobs,
         messenger,
         *,
@@ -140,6 +142,30 @@ class CASDProcessManager:
             if remote_cache_spec.request_timeout is not None:
                 casd_args.append("--cas-request-timeout={}".format(remote_cache_spec.request_timeout))
 
+        if remote_action_cache_spec:
+            casd_args.append("--ac-remote={}".format(remote_action_cache_spec.url))
+            if remote_action_cache_spec.instance_name:
+                casd_args.append("--ac-instance={}".format(remote_action_cache_spec.instance_name))
+            if remote_action_cache_spec.server_cert_file:
+                casd_args.append("--ac-server-cert={}".format(remote_action_cache_spec.server_cert_file))
+            if remote_action_cache_spec.client_key_file:
+                casd_args.append("--ac-client-key={}".format(remote_action_cache_spec.client_key_file))
+                casd_args.append("--ac-client-cert={}".format(remote_action_cache_spec.client_cert_file))
+            if remote_action_cache_spec.access_token_file:
+                casd_args.append("--ac-access-token={}".format(remote_action_cache_spec.access_token_file))
+                if remote_action_cache_spec.access_token_reload_interval is not None:
+                    casd_args.append(
+                        "--ac-token-reload-interval={}".format(remote_action_cache_spec.access_token_reload_interval)
+                    )
+            if remote_action_cache_spec.keepalive_time is not None:
+                casd_args.append("--ac-keepalive-time={}".format(remote_action_cache_spec.keepalive_time))
+            if remote_action_cache_spec.retry_limit is not None:
+                casd_args.append("--ac-retry-limit={}".format(remote_action_cache_spec.retry_limit))
+            if remote_action_cache_spec.retry_delay is not None:
+                casd_args.append("--ac-retry-delay={}".format(remote_action_cache_spec.retry_delay))
+            if remote_action_cache_spec.request_timeout is not None:
+                casd_args.append("--ac-request-timeout={}".format(remote_action_cache_spec.request_timeout))
+
         casd_args.append(path)
 
         self._start_time = time.time()
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index 02942c8b0..85d72b82d 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -194,6 +194,9 @@ class Context:
         # Remote cache server
         self.remote_cache_spec: Optional[RemoteSpec] = None
 
+        # Remote action cache server
+        self.remote_action_cache_spec: Optional[RemoteSpec] = None
+
         # Whether or not to attempt to pull build trees globally
         self.pull_buildtrees: Optional[bool] = None
 
@@ -369,7 +372,15 @@ class Context:
         # casdir - the casdir may not have been created yet.
         cache = defaults.get_mapping("cache")
         cache.validate_keys(
-            ["quota", "reserved-disk-space", "low-watermark", "storage-service", "pull-buildtrees", "cache-buildtrees"]
+            [
+                "quota",
+                "reserved-disk-space",
+                "low-watermark",
+                "storage-service",
+                "action-cache-service",
+                "pull-buildtrees",
+                "cache-buildtrees",
+            ]
         )
 
         cas_volume = self.casdir
@@ -416,6 +427,15 @@ class Context:
         if remote_cache:
             self.remote_cache_spec = RemoteSpec.new_from_node(remote_cache)
 
+        remote_action_cache = cache.get_mapping("action-cache-service", default=None)
+        if remote_action_cache:
+            if not remote_cache:
+                raise LoadError(
+                    "{}: 'action-cache-service' cannot be configured without 'storage-service'.".format(provenance),
+                    LoadErrorReason.INVALID_DATA,
+                )
+            self.remote_action_cache_spec = RemoteSpec.new_from_node(remote_action_cache)
+
         # Load global artifact cache configuration
         cache_config = defaults.get_mapping("artifacts", default={})
         self._global_artifact_cache_config = _CacheConfig.new_from_node(cache_config)
@@ -741,6 +761,7 @@ class Context:
                 log_level,
                 self.config_cache_quota,
                 self.remote_cache_spec,
+                self.remote_action_cache_spec,
                 protect_session_blobs=True,
                 messenger=self.messenger,
                 reserved=self.config_cache_reserved,
diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py
index 09b824ff3..b9c90f1e0 100644
--- a/src/buildstream/_frontend/widget.py
+++ b/src/buildstream/_frontend/widget.py
@@ -525,6 +525,8 @@ class LogLine(Widget):
 
         if context.remote_cache_spec:
             values["Cache Storage Service"] = format_spec(context.remote_cache_spec)
+        if context.remote_action_cache_spec:
+            values["Action Cache Service"] = format_spec(context.remote_action_cache_spec)
 
         text += self._format_values(values)
 
diff --git a/src/buildstream/sandbox/_sandboxbuildboxrun.py b/src/buildstream/sandbox/_sandboxbuildboxrun.py
index d4b49860a..2f2735c0c 100644
--- a/src/buildstream/sandbox/_sandboxbuildboxrun.py
+++ b/src/buildstream/sandbox/_sandboxbuildboxrun.py
@@ -94,8 +94,10 @@ class SandboxBuildBoxRun(SandboxREAPI):
         casd = cascache.get_casd()
         config = self._get_config()
 
-        if config.remote_apis_socket_path and context.remote_cache_spec:
-            raise SandboxError("'remote-apis-socket' is not currently supported with 'storage-service'.")
+        if config.remote_apis_socket_path and context.remote_cache_spec and not context.remote_action_cache_spec:
+            raise SandboxError(
+                "'remote-apis-socket' is not supported with 'storage-service' without 'action-cache-service'."
+            )
 
         with utils._tempnamedfile() as action_file, utils._tempnamedfile() as result_file:
             action_file.write(action.SerializeToString())