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 <grfn@gws.fyi>
Change-Id: If7332337b89506c7e404cd20174acdaa1a3be4e8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1793
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
Vincent Ambo 2020-08-20 02:32:51 +01:00 committed by tazjin
parent 883de9b8d7
commit 19e874a985
5 changed files with 92 additions and 25 deletions

View file

@ -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;