xref: /aosp_15_r20/external/googleapis/google/devtools/build/v1/build_events.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
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
15syntax = "proto3";
16
17package google.devtools.build.v1;
18
19import "google/devtools/build/v1/build_status.proto";
20import "google/protobuf/any.proto";
21import "google/protobuf/timestamp.proto";
22
23option cc_enable_arenas = true;
24option go_package = "google.golang.org/genproto/googleapis/devtools/build/v1;build";
25option java_multiple_files = true;
26option java_outer_classname = "BuildEventProto";
27option java_package = "com.google.devtools.build.v1";
28option php_namespace = "Google\\Cloud\\Build\\V1";
29
30// An event representing some state change that occurred in the build. This
31// message does not include field for uniquely identifying an event.
32message BuildEvent {
33  // Notification that the build system has attempted to run the build tool.
34  message InvocationAttemptStarted {
35    // The number of the invocation attempt, starting at 1 and increasing by 1
36    // for each new attempt. Can be used to determine if there is a later
37    // invocation attempt replacing the current one a client is processing.
38    int64 attempt_number = 1;
39
40    // Arbitrary details about the invocation attempt.
41    google.protobuf.Any details = 2;
42  }
43
44  // Notification that an invocation attempt has finished.
45  message InvocationAttemptFinished {
46    // Final status of the invocation.
47    BuildStatus invocation_status = 3;
48
49    // Arbitrary details about the invocation attempt.
50    google.protobuf.Any details = 4;
51  }
52
53  // Notification that the build request is enqueued.
54  message BuildEnqueued {
55    // Additional details about the Build.
56    google.protobuf.Any details = 1;
57  }
58
59  // Notification that the build request has finished, and no further
60  // invocations will occur.  Note that this applies to the entire Build.
61  // Individual invocations trigger InvocationFinished when they finish.
62  message BuildFinished {
63    // Final status of the build.
64    BuildStatus status = 1;
65
66    // Additional details about the Build.
67    google.protobuf.Any details = 2;
68  }
69
70  // Textual output written to standard output or standard error.
71  message ConsoleOutput {
72    // The output stream type.
73    ConsoleOutputStream type = 1;
74
75    // The output stream content.
76    oneof output {
77      // Regular UTF-8 output; normal text.
78      string text_output = 2;
79
80      // Used if the output is not UTF-8 text (for example, a binary proto).
81      bytes binary_output = 3;
82    }
83  }
84
85  // Notification of the end of a build event stream published by a build
86  // component other than CONTROLLER (See StreamId.BuildComponents).
87  message BuildComponentStreamFinished {
88    // How did the event stream finish.
89    enum FinishType {
90      // Unknown or unspecified; callers should never set this value.
91      FINISH_TYPE_UNSPECIFIED = 0;
92
93      // Set by the event publisher to indicate a build event stream is
94      // finished.
95      FINISHED = 1;
96
97      // Set by the WatchBuild RPC server when the publisher of a build event
98      // stream stops publishing events without publishing a
99      // BuildComponentStreamFinished event whose type equals FINISHED.
100      EXPIRED = 2;
101    }
102
103    // How the event stream finished.
104    FinishType type = 1;
105  }
106
107  // This should be precisely the time when this event happened, and not when
108  // the event proto was created or sent.
109  google.protobuf.Timestamp event_time = 1;
110
111  // //////////////////////////////////////////////////////////////////////////
112  // Events that indicate a state change of a build request in the build
113  // queue.
114  oneof event {
115    // An invocation attempt has started.
116    InvocationAttemptStarted invocation_attempt_started = 51;
117
118    // An invocation attempt has finished.
119    InvocationAttemptFinished invocation_attempt_finished = 52;
120
121    // The build is enqueued.
122    BuildEnqueued build_enqueued = 53;
123
124    // The build has finished. Set when the build is terminated.
125    BuildFinished build_finished = 55;
126
127    // An event containing printed text.
128    ConsoleOutput console_output = 56;
129
130    // Indicates the end of a build event stream (with the same StreamId) from
131    // a build component executing the requested build task.
132    // *** This field does not indicate the WatchBuild RPC is finished. ***
133    BuildComponentStreamFinished component_stream_finished = 59;
134
135    // Structured build event generated by Bazel about its execution progress.
136    google.protobuf.Any bazel_event = 60;
137
138    // An event that contains supplemental tool-specific information about
139    // build execution.
140    google.protobuf.Any build_execution_event = 61;
141
142    // An event that contains supplemental tool-specific information about
143    // source fetching.
144    google.protobuf.Any source_fetch_event = 62;
145  }
146}
147
148// Unique identifier for a build event stream.
149message StreamId {
150  // Which build component generates this event stream. Each build component
151  // may generate one event stream.
152  enum BuildComponent {
153    // Unknown or unspecified; callers should never set this value.
154    UNKNOWN_COMPONENT = 0;
155
156    // A component that coordinates builds.
157    CONTROLLER = 1;
158
159    // A component that runs executables needed to complete a build.
160    WORKER = 2;
161
162    // A component that builds something.
163    TOOL = 3;
164  }
165
166  // The id of a Build message.
167  string build_id = 1;
168
169  // The unique invocation ID within this build.
170  // It should be the same as {invocation} (below) during the migration.
171  string invocation_id = 6;
172
173  // The component that emitted this event.
174  BuildComponent component = 3;
175}
176
177// The type of console output stream.
178enum ConsoleOutputStream {
179  // Unspecified or unknown.
180  UNKNOWN = 0;
181
182  // Normal output stream.
183  STDOUT = 1;
184
185  // Error output stream.
186  STDERR = 2;
187}
188