Skip to content

Commit b90cc67

Browse files
committed
proto: update proto from Bazel upstream
These proto files are taken from commit bazelbuild/bazel@76117b4 Highlight: - Inclusion of ActionCacheStatistics in build_event_stream bazelbuild/bazel#17615 - Explicit Execution phase timing (in prepare for Skymeld) bazelbuild/bazel@be63eee - If `--noallow_analysis_cache_discard` is set, BuildFinished may contains FailureDetails -> CONFIGURATION_DISCARDED_ANALYSIS_CACHE. bazelbuild/bazel#16805 - ExecRequest event is included for `bazel run` bazelbuild/bazel@9a047de - TestProgress event is included for TestRunner action bazelbuild/bazel@d8b8ab0 - ActionExecuted now includes start/end time and strategy information bazelbuild/bazel@2ddacab
1 parent 7f88f02 commit b90cc67

File tree

5 files changed

+166
-5
lines changed

5 files changed

+166
-5
lines changed

proto/BUILD

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ proto_library(
1212
],
1313
)
1414

15+
proto_library(
16+
name = "action_cache_proto",
17+
srcs = ["action_cache.proto"],
18+
)
19+
1520
proto_library(
1621
name = "api_key_proto",
1722
srcs = ["api_key.proto"],
@@ -345,10 +350,12 @@ proto_library(
345350
name = "build_event_stream_proto",
346351
srcs = ["build_event_stream.proto"],
347352
deps = [
353+
":action_cache_proto",
348354
":command_line_proto",
349355
":failure_details_proto",
350356
":invocation_policy_proto",
351357
":package_load_metrics_proto",
358+
"@com_google_protobuf//:any_proto",
352359
"@com_google_protobuf//:duration_proto",
353360
"@com_google_protobuf//:timestamp_proto",
354361
],
@@ -647,6 +654,12 @@ go_proto_library(
647654
],
648655
)
649656

657+
go_proto_library(
658+
name = "action_cache_go_proto",
659+
importpath = "github.com/buildbuddy-io/buildbuddy/proto/action_cache",
660+
proto = ":action_cache_proto",
661+
)
662+
650663
go_proto_library(
651664
name = "api_key_go_proto",
652665
importpath = "github.com/buildbuddy-io/buildbuddy/proto/api_key",
@@ -799,6 +812,7 @@ go_proto_library(
799812
importpath = "github.com/buildbuddy-io/buildbuddy/proto/build_event_stream",
800813
proto = ":build_event_stream_proto",
801814
deps = [
815+
":action_cache_go_proto",
802816
":command_line_go_proto",
803817
":failure_details_go_proto",
804818
":invocation_policy_go_proto",
@@ -1282,6 +1296,11 @@ ts_proto_library(
12821296
],
12831297
)
12841298

1299+
ts_proto_library(
1300+
name = "action_cache_ts_proto",
1301+
proto = ":action_cache_proto",
1302+
)
1303+
12851304
ts_proto_library(
12861305
name = "api_key_ts_proto",
12871306
proto = ":api_key_proto",
@@ -1445,6 +1464,8 @@ ts_proto_library(
14451464
name = "build_event_stream_ts_proto",
14461465
proto = ":build_event_stream_proto",
14471466
deps = [
1467+
":action_cache_ts_proto",
1468+
":any_ts_proto",
14481469
":command_line_ts_proto",
14491470
":descriptor_ts_proto",
14501471
":duration_ts_proto",

proto/action_cache.proto

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright 2017 The Bazel Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package blaze;
18+
19+
option java_package = "com.google.devtools.build.lib.actions.cache";
20+
option java_outer_classname = "Protos";
21+
22+
// Information about the action cache behavior during a single build.
23+
message ActionCacheStatistics {
24+
// Size of the action cache in bytes.
25+
//
26+
// This is computed by the code that persists the action cache to disk and
27+
// represents the size of the written files, which has no direct relation to
28+
// the number of entries in the cache.
29+
uint64 size_in_bytes = 1;
30+
31+
// Time it took to save the action cache to disk.
32+
uint64 save_time_in_ms = 2;
33+
34+
// Reasons for not finding an action in the cache.
35+
enum MissReason {
36+
DIFFERENT_ACTION_KEY = 0;
37+
DIFFERENT_DEPS = 1;
38+
DIFFERENT_ENVIRONMENT = 2;
39+
DIFFERENT_FILES = 3;
40+
CORRUPTED_CACHE_ENTRY = 4;
41+
NOT_CACHED = 5;
42+
UNCONDITIONAL_EXECUTION = 6;
43+
}
44+
45+
// Detailed information for a particular miss reason.
46+
message MissDetail {
47+
MissReason reason = 1;
48+
int32 count = 2;
49+
}
50+
51+
// Cache counters.
52+
int32 hits = 3;
53+
int32 misses = 4;
54+
55+
// Breakdown of the cache misses based on the reasons behind them.
56+
repeated MissDetail miss_details = 5;
57+
58+
// NEXT TAG: 6
59+
}

proto/build_event_stream.proto

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// LINT: LEGACY_NAMES
16+
1517
syntax = "proto3";
1618

1719
package build_event_stream;
1820

21+
import "google/protobuf/any.proto";
1922
import "google/protobuf/duration.proto";
2023
import "google/protobuf/timestamp.proto";
24+
import "proto/action_cache.proto";
2125
import "proto/command_line.proto";
2226
import "proto/invocation_policy.proto";
2327
import "proto/failure_details.proto";
@@ -200,6 +204,24 @@ message BuildEventId {
200204
int32 attempt = 4;
201205
}
202206

207+
// Identifier of an event reporting progress of an individual test run.
208+
message TestProgressId {
209+
// The label of the target for the action.
210+
string label = 1;
211+
// The configuration under which the action is running.
212+
ConfigurationId configuration = 2;
213+
// The run number of the test action (e.g. for runs_per_test > 1).
214+
int32 run = 3;
215+
// For sharded tests, the shard number of the test action.
216+
int32 shard = 4;
217+
// The execution attempt number which may increase due to retries (e.g. for
218+
// flaky tests).
219+
int32 attempt = 5;
220+
// An incrementing count used to differentiate TestProgressIds for the same
221+
// test attempt.
222+
int32 opaque_count = 6;
223+
}
224+
203225
// Identifier of an event reporting the summary of a test.
204226
message TestSummaryId {
205227
string label = 1;
@@ -229,6 +251,9 @@ message BuildEventId {
229251
// Identifier of an event signalling that the coverage actions are finished.
230252
message CoverageActionsFinishedId {}
231253

254+
// Identifier of an event providing the ExecRequest of a run command.
255+
message ExecRequestId {}
256+
232257
// BUILDBUDDY-SPECIFIC EVENTS BELOW
233258

234259
// Identifier of an event providing a list of bazel commands that are
@@ -281,6 +306,7 @@ message BuildEventId {
281306
UnconfiguredLabelId unconfigured_label = 19;
282307
ConfiguredLabelId configured_label = 21;
283308
TestResultId test_result = 8;
309+
TestProgressId test_progress = 29;
284310
TestSummaryId test_summary = 7;
285311
TargetSummaryId target_summary = 26;
286312
BuildFinishedId build_finished = 9;
@@ -290,6 +316,7 @@ message BuildEventId {
290316
BuildMetadataId build_metadata = 24;
291317
ConvenienceSymlinksIdentifiedId convenience_symlinks_identified = 25;
292318
CoverageActionsFinishedId coverage_actions_finished = 27;
319+
ExecRequestId exec_request = 28;
293320

294321
// BUILDBUDDY EVENTS BELOW
295322
// Starting at field #1000 to avoid conflicting with potential future
@@ -599,6 +626,15 @@ message ActionExecuted {
599626

600627
// Only populated if success = false, and sometimes not even then.
601628
failure_details.FailureDetail failure_detail = 11;
629+
630+
// Start of action execution, before any attempted execution begins.
631+
google.protobuf.Timestamp start_time = 12;
632+
633+
// End of action execution, after all attempted execution completes.
634+
google.protobuf.Timestamp end_time = 13;
635+
636+
// Additional details about action execution supplied by any/all strategies.
637+
repeated google.protobuf.Any strategy_details = 14;
602638
}
603639

604640
// Collection of all output files belonging to that output group.
@@ -768,6 +804,15 @@ message TestResult {
768804
ExecutionInfo execution_info = 8;
769805
}
770806

807+
// Event payload providing information about an active, individual test run.
808+
message TestProgress {
809+
// Identifies a resource that may provide information about an active test
810+
// run. The resource is not necessarily a file and may need to be queried
811+
// for information. The URI is not guaranteed to be available after the test
812+
// completes. The string is encoded according to RFC2396.
813+
string uri = 1;
814+
}
815+
771816
// Payload of the event summarizing a test.
772817
message TestSummary {
773818
// Wrapper around BlazeTestStatus to support importing that enum to proto3.
@@ -883,6 +928,9 @@ message BuildFinished {
883928
google.protobuf.Timestamp finish_time = 5;
884929

885930
AnomalyReport anomaly_report = 4 [deprecated = true];
931+
932+
// Only populated if success = false, and sometimes not even then.
933+
failure_details.FailureDetail failure_detail = 6;
886934
}
887935

888936
message BuildMetrics {
@@ -938,6 +986,8 @@ message BuildMetrics {
938986
string exec_kind = 3;
939987
}
940988
repeated RunnerCount runner_count = 6;
989+
990+
blaze.ActionCacheStatistics action_cache_statistics = 7;
941991
}
942992
ActionSummary action_summary = 1;
943993

@@ -1010,6 +1060,9 @@ message BuildMetrics {
10101060
PackageMetrics package_metrics = 4;
10111061

10121062
message TimingMetrics {
1063+
// For Skymeld,
1064+
// analysis_phase_time_in_ms + execution_phase_time_in_ms >= wall_time_in_ms
1065+
//
10131066
// The CPU time in milliseconds consumed during this build.
10141067
int64 cpu_time_in_ms = 1;
10151068
// The elapsed wall time in milliseconds during this build.
@@ -1018,6 +1071,10 @@ message BuildMetrics {
10181071
// When analysis and execution phases are interleaved, this measures the
10191072
// elapsed time from the first analysis work to the last.
10201073
int64 analysis_phase_time_in_ms = 3;
1074+
// The elapsed wall time in milliseconds during the execution phase.
1075+
// When analysis and execution phases are interleaved, this measures the
1076+
// elapsed time from the first action execution to the last.
1077+
int64 execution_phase_time_in_ms = 4;
10211078
}
10221079
TimingMetrics timing_metrics = 5;
10231080

@@ -1240,6 +1297,22 @@ message ConvenienceSymlink {
12401297
string target = 3;
12411298
}
12421299

1300+
// Event that contains the ExecRequest of a run command announced only after a
1301+
// successful build and before trying to execute the requested command-line.
1302+
message ExecRequestConstructed {
1303+
bytes working_directory = 1;
1304+
repeated bytes argv = 2;
1305+
repeated EnvironmentVariable environment_variable = 3;
1306+
repeated bytes environment_variable_to_clear = 4;
1307+
bool should_exec = 5;
1308+
}
1309+
1310+
// An environment variable provided by a run command after a successful build.
1311+
message EnvironmentVariable {
1312+
bytes name = 1;
1313+
bytes value = 2;
1314+
}
1315+
12431316
// BUILDBUDDY-SPECIFIC EVENTS BELOW
12441317

12451318
// Event describing a workflow invocation as well as the bazel commands to be
@@ -1418,6 +1491,7 @@ message BuildEvent {
14181491
NamedSetOfFiles named_set_of_files = 15;
14191492
TargetComplete completed = 8;
14201493
TestResult test_result = 10;
1494+
TestProgress test_progress = 30;
14211495
TestSummary test_summary = 9;
14221496
TargetSummary target_summary = 28;
14231497
BuildFinished finished = 14;
@@ -1426,6 +1500,7 @@ message BuildEvent {
14261500
WorkspaceConfig workspace_info = 25;
14271501
BuildMetadata build_metadata = 26;
14281502
ConvenienceSymlinksIdentified convenience_symlinks_identified = 27;
1503+
ExecRequestConstructed exec_request = 29;
14291504

14301505
// BUILDBUDDY-SPECIFIC EVENTS BELOW.
14311506
// Starting at field #1000 to avoid conflicting with potential future

proto/failure_details.proto

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ message FailureDetail {
147147
StarlarkLoading starlark_loading = 179;
148148
ExternalDeps external_deps = 181;
149149
DiffAwareness diff_awareness = 182;
150-
ModqueryCommand modquery_command = 183;
150+
ModCommand mod_command = 183;
151151
BuildReport build_report = 184;
152152
}
153153

@@ -278,7 +278,7 @@ message BuildProgress {
278278
[(metadata) = { exit_code: 45 }];
279279
BES_UPLOAD_RETRY_LIMIT_EXCEEDED_FAILURE = 17
280280
[(metadata) = { exit_code: 38 }];
281-
reserved 1, 2, 18; // For internal use
281+
reserved 1, 2, 18, 20; // For internal use
282282
}
283283
Code code = 1;
284284
// Additional data could include the build progress upload endpoint.
@@ -295,6 +295,7 @@ message RemoteOptions {
295295
CREDENTIALS_WRITE_FAILURE = 3 [(metadata) = { exit_code: 36 }];
296296
DOWNLOADER_WITHOUT_GRPC_CACHE = 4 [(metadata) = { exit_code: 2 }];
297297
EXECUTION_WITH_INVALID_CACHE = 5 [(metadata) = { exit_code: 2 }];
298+
EXECUTION_WITH_SCRUBBING = 6 [(metadata) = { exit_code: 2 }];
298299
}
299300

300301
Code code = 1;
@@ -458,6 +459,7 @@ message Execution {
458459
UNEXPECTED_EXCEPTION = 37 [(metadata) = { exit_code: 1 }];
459460
reserved 38;
460461
SOURCE_INPUT_IO_EXCEPTION = 39 [(metadata) = { exit_code: 1 }];
462+
SYMLINK_TREE_DELETION_IO_EXCEPTION = 40 [(metadata) = { exit_code: 36 }];
461463
}
462464

463465
Code code = 1;
@@ -608,6 +610,7 @@ message BuildConfiguration {
608610
// possibilities in Bazel, so we go with the more straightforward
609611
// command-line error exit code 2.
610612
INVALID_OUTPUT_DIRECTORY_MNEMONIC = 11 [(metadata) = { exit_code: 2 }];
613+
CONFIGURATION_DISCARDED_ANALYSIS_CACHE = 12 [(metadata) = { exit_code: 2 }];
611614
}
612615

613616
Code code = 1;
@@ -1031,6 +1034,7 @@ message ActionRewinding {
10311034
ACTION_REWINDING_UNKNOWN = 0 [(metadata) = { exit_code: 37 }];
10321035
LOST_INPUT_TOO_MANY_TIMES = 1 [(metadata) = { exit_code: 1 }];
10331036
LOST_INPUT_IS_SOURCE = 2 [(metadata) = { exit_code: 1 }];
1037+
REWIND_LOST_INPUTS_PREREQ_UNMET = 3 [(metadata) = { exit_code: 2 }];
10341038
}
10351039

10361040
Code code = 1;
@@ -1197,6 +1201,7 @@ message Analysis {
11971201
CONFIGURED_VALUE_CREATION_FAILED = 18 [(metadata) = { exit_code: 1 }];
11981202
INCOMPATIBLE_TARGET_REQUESTED = 19 [(metadata) = { exit_code: 1 }];
11991203
ANALYSIS_FAILURE_PROPAGATION_FAILED = 20 [(metadata) = { exit_code: 1 }];
1204+
ANALYSIS_CACHE_DISCARDED = 21 [(metadata) = { exit_code: 1 }];
12001205
}
12011206

12021207
Code code = 1;
@@ -1243,6 +1248,7 @@ message PackageLoading {
12431248
BUILTINS_INJECTION_FAILURE = 29 [(metadata) = { exit_code: 1 }];
12441249
SYMLINK_CYCLE_OR_INFINITE_EXPANSION = 30 [(metadata) = { exit_code: 1 }];
12451250
OTHER_IO_EXCEPTION = 31 [(metadata) = { exit_code: 36 }];
1251+
BAD_REPO_FILE = 32 [(metadata) = { exit_code: 1 }];
12461252
}
12471253

12481254
Code code = 1;
@@ -1303,9 +1309,9 @@ message DiffAwareness {
13031309
Code code = 1;
13041310
}
13051311

1306-
message ModqueryCommand {
1312+
message ModCommand {
13071313
enum Code {
1308-
MODQUERY_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }];
1314+
MOD_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }];
13091315
MISSING_ARGUMENTS = 1 [(metadata) = { exit_code: 2 }];
13101316
TOO_MANY_ARGUMENTS = 2 [(metadata) = { exit_code: 2 }];
13111317
INVALID_ARGUMENTS = 3 [(metadata) = { exit_code: 2 }];

proto/option_filters.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ enum OptionMetadataTag {
5555
INTERNAL = 4;
5656
reserved "TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES";
5757
reserved 5;
58-
EXPLICIT_IN_OUTPUT_PATH = 6;
58+
reserved 6;
5959
}

0 commit comments

Comments
 (0)