summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2023-09-29 15:14:46 +0200
committerAlberto Sartori <alberto.sartori@huawei.com>2023-11-15 20:19:18 +0100
commit03a93bafbdd02bbb4e4f342d9d9e152293f990ae (patch)
treee71964bc612ed1db8a3625406a7fb654200965f7
parente1e82f82251fc16b648571396ff27445a110c15e (diff)
downloadjustbuild-03a93bafbdd02bbb4e4f342d9d9e152293f990ae.tar.gz
just_serve.proto: define service Target
It defines two RPC: - ServeTarget: Given a target-level caching key, returns the computed value. - ServeTargetVariables: Given the target-level root tree and the name of an export target, returns the list of flexible variables from that target's description. Co-authored-by: Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com>
-rw-r--r--src/buildtool/serve_api/serve_service/TARGETS1
-rw-r--r--src/buildtool/serve_api/serve_service/just_serve.proto67
2 files changed, 68 insertions, 0 deletions
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS
index c1a891d1..953da5d6 100644
--- a/src/buildtool/serve_api/serve_service/TARGETS
+++ b/src/buildtool/serve_api/serve_service/TARGETS
@@ -3,6 +3,7 @@
, "name": ["just_serve_proto"]
, "service": ["yes"]
, "srcs": ["just_serve.proto"]
+ , "deps": [["@", "bazel_remote_apis", "", "remote_execution_proto"]]
, "stage": ["justbuild", "just_serve"]
}
, "source_tree":
diff --git a/src/buildtool/serve_api/serve_service/just_serve.proto b/src/buildtool/serve_api/serve_service/just_serve.proto
index 9d2c7fdd..06c60134 100644
--- a/src/buildtool/serve_api/serve_service/just_serve.proto
+++ b/src/buildtool/serve_api/serve_service/just_serve.proto
@@ -16,6 +16,8 @@ syntax = "proto3";
package justbuild.just_serve;
+import "build/bazel/remote/execution/v2/remote_execution.proto";
+
// A request message for
// [TargetLevelCache.ServeCommitTree][justbuild.just_serve.TargetLevelCache.ServeCommitTree].
message ServeCommitTreeRequest {
@@ -139,3 +141,68 @@ service SourceTree {
// There are no method-specific errors.
rpc ServeArchiveTree(ServeArchiveTreeRequest) returns (ServeArchiveTreeResponse) {}
}
+
+message ServeTargetRequest {
+ // Digest of the blob containing the target description
+ //
+ // The client has to guarantee that the blob is present in the remote CAS
+ // before calling ServeTarget
+ build.bazel.remote.execution.v2.Digest target_cache_key_id = 1;
+
+ // Digest of the blob containing the execution backend description
+ //
+ // The client has to guarantee that the blob has been uploaded to the remote
+ // CAS
+ build.bazel.remote.execution.v2.Digest execution_backend_description_id = 2;
+}
+
+message ServeTargetResponse {
+ // Digest of the blob with the JSON object containing the target-cache value
+ // The implementation must guarantee that all the referenced objects are
+ // present in the remote CAS.
+ build.bazel.remote.execution.v2.Digest target_value = 1;
+}
+
+message ServeTargetVariablesRequest {
+ // Git hash of the target-level root tree.
+ string root_tree = 1;
+
+ // Relative path of the targets file inside the root tree.
+ string target_file = 2;
+
+ // Name of the export target to look up.
+ string target = 3;
+}
+
+message ServeTargetVariablesResponse {
+ // List of flexible configuration variables.
+ repeated string flexible_config = 1;
+}
+
+service Target {
+ // Given a target-level caching key, returns the computed value. In doing so,
+ // it can build on the associated end-point passing the
+ // RemoteExecutionProperties contained in the ServeTargetRequest.
+ //
+ // If the status has a code different from `OK`, the response MUST not be used.
+ //
+ // Errors:
+ // * `FAILED_PRECONDITION`: Failed to find required information in the CAS or
+ // the target cache key is malformed.
+ // * `UNAVAILABLE`: Could not communicate with the remote execution endpoint.
+ // * `INTERNAL`: Internally, something is very broken.
+ rpc ServeTarget(ServeTargetRequest) returns (ServeTargetResponse) {}
+
+ // Given the target-level root tree and the name of an export target, returns
+ // the list of flexible variables from that target's description.
+ //
+ // If the status has a code different from `OK`, the response MUST not be used.
+ //
+ // Errors:
+ // * `FAILED_PRECONDITION`: An error occurred in retrieving the configuration
+ // of the requested target, such as missing entries (target-root, target
+ // file, target name), unparsable target file, or requested target not
+ // being of "type" : "export".
+ // * `INTERNAL`: Internally, something is very broken.
+ rpc ServeTargetVariables(ServeTargetVariablesRequest) returns (ServeTargetVariablesResponse) {}
+}