From 19e874a9854c0d7f49d79fa98177a84b6997ce9a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 20 Aug 2020 02:32:51 +0100 Subject: feat(tvix): Introduce build event streams in worker protocol Introduces a new `BuildEvent` proto type which is streamed in response to calls that trigger builds of derivations. This type can currently supply build statuses, log lines and information about builds starting. This is in preparation for threading build logs through the processes. Since we have nowhere to send the logs (yet), a null sink is used instead. Co-authored-by: Griffin Smith Change-Id: If7332337b89506c7e404cd20174acdaa1a3be4e8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1793 Tested-by: BuildkiteCI Reviewed-by: glittershark Reviewed-by: kanepyork --- third_party/nix/src/proto/worker.proto | 35 +++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'third_party/nix/src/proto/worker.proto') diff --git a/third_party/nix/src/proto/worker.proto b/third_party/nix/src/proto/worker.proto index fe89b292a2..6a80b3e32b 100644 --- a/third_party/nix/src/proto/worker.proto +++ b/third_party/nix/src/proto/worker.proto @@ -27,7 +27,7 @@ service WorkerService { // Build the specified derivations in one of the specified build // modes, defaulting to a normal build. - rpc BuildPaths(BuildPathsRequest) returns (google.protobuf.Empty); + rpc BuildPaths(BuildPathsRequest) returns (stream BuildEvent); // TODO: What does this do? rpc EnsurePath(StorePath) returns (google.protobuf.Empty); @@ -90,7 +90,7 @@ service WorkerService { // Build a single non-materialized derivation (i.e. not from an // on-disk .drv file). - rpc BuildDerivation(BuildDerivationRequest) returns (BuildDerivationResponse); + rpc BuildDerivation(BuildDerivationRequest) returns (stream BuildEvent); // Add signatures to the specified store path. The signatures are not // verified. @@ -174,6 +174,32 @@ message Signatures { repeated string sigs = 1; } +// Represents the outcome of a build for a single store path. +message BuildResult { + StorePath path = 1; + BuildStatus status = 2; + string msg = 3; +} + +// Represents an event occuring during a build. +message BuildEvent { + message LogLine { + string line = 1; + StorePath path = 2; + } + + oneof result_type { + // Build for a store path has finished + BuildResult result = 1; + + // A line of build log output was produced + LogLine build_log = 2; + + // Build for a store path has started + StorePath building_path = 3; + } +} + message IsValidPathResponse { bool is_valid = 1; } @@ -316,11 +342,6 @@ message BuildDerivationRequest { BuildMode build_mode = 3; } -message BuildDerivationResponse { - BuildStatus status = 1; - string error_message = 2; -} - message AddSignaturesRequest { StorePath path = 1; Signatures sigs = 2; -- cgit 1.4.1