go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/resultdb/proto/v1/invocation.proto (about) 1 // Copyright 2019 The LUCI Authors. 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 luci.resultdb.v1; 18 19 import "google/api/field_behavior.proto"; 20 import "google/protobuf/struct.proto"; 21 import "google/protobuf/timestamp.proto"; 22 import "go.chromium.org/luci/resultdb/proto/v1/common.proto"; 23 import "go.chromium.org/luci/resultdb/proto/v1/predicate.proto"; 24 25 option go_package = "go.chromium.org/luci/resultdb/proto/v1;resultpb"; 26 27 // A conceptual container of results. Immutable once finalized. 28 // It represents all results of some computation; examples: swarming task, 29 // buildbucket build, CQ attempt. 30 // Composable: can include other invocations, see inclusion.proto. 31 // 32 // Next id: 17. 33 message Invocation { 34 reserved 3; // bool interrupted, crbug.com/1078696. 35 36 // Can be used to refer to this invocation, e.g. in ResultDB.GetInvocation 37 // RPC. 38 // Format: invocations/{INVOCATION_ID} 39 // See also https://aip.dev/122. 40 // 41 // Output only. 42 string name = 1 [ 43 (google.api.field_behavior) = OUTPUT_ONLY, 44 (google.api.field_behavior) = IMMUTABLE 45 ]; 46 47 enum State { 48 // The default value. This value is used if the state is omitted. 49 STATE_UNSPECIFIED = 0; 50 51 // The invocation was created and accepts new results. 52 ACTIVE = 1; 53 54 // The invocation is in the process of transitioning into FINALIZED state. 55 // This will happen automatically soon after all of its directly or 56 // indirectly included invocations become inactive. 57 FINALIZING = 2; 58 59 // The invocation is immutable and no longer accepts new results nor 60 // inclusions directly or indirectly. 61 FINALIZED = 3; 62 } 63 64 // Current state of the invocation. 65 // 66 // At creation time this can be set to FINALIZING e.g. if this invocation is 67 // a simple wrapper of another and will itself not be modified. 68 // 69 // Otherwise this is an output only field. 70 State state = 2; 71 72 // When the invocation was created. 73 // Output only. 74 google.protobuf.Timestamp create_time = 4 [ 75 (google.api.field_behavior) = OUTPUT_ONLY, 76 (google.api.field_behavior) = IMMUTABLE 77 ]; 78 79 // Invocation-level string key-value pairs. 80 // A key can be repeated. 81 repeated StringPair tags = 5; 82 83 // == Finalization =========================================================== 84 85 // When the invocation was finalized, i.e. transitioned to FINALIZED state. 86 // If this field is set, implies that the invocation is finalized. 87 // 88 // Output only. 89 google.protobuf.Timestamp finalize_time = 6 90 [ (google.api.field_behavior) = OUTPUT_ONLY ]; 91 92 // Timestamp when the invocation will be forcefully finalized. 93 // Can be extended with UpdateInvocation until finalized. 94 google.protobuf.Timestamp deadline = 7; 95 96 // Names of invocations included into this one. Overall results of this 97 // invocation is a UNION of results directly included into this invocation 98 // and results from the included invocations, recursively. 99 // For example, a Buildbucket build invocation may include invocations of its 100 // child swarming tasks and represent overall result of the build, 101 // encapsulating the internal structure of the build. 102 // 103 // The graph is directed. 104 // There can be at most one edge between a given pair of invocations. 105 // The shape of the graph does not matter. What matters is only the set of 106 // reachable invocations. Thus cycles are allowed and are noop. 107 // 108 // QueryTestResults returns test results from the transitive closure of 109 // invocations. 110 // 111 // This field can be set under Recorder.CreateInvocationsRequest to include 112 // existing invocations at the moment of invocation creation. 113 // New invocations created in the same batch (via 114 // Recorder.BatchCreateInvocationsRequest) are also allowed. 115 // Otherwise, this field is to be treated as Output only. 116 // 117 // To modify included invocations, use Recorder.UpdateIncludedInvocations in 118 // all other cases. 119 repeated string included_invocations = 8; 120 121 // bigquery_exports indicates what BigQuery table(s) that results in this 122 // invocation should export to. 123 repeated BigQueryExport bigquery_exports = 9; 124 125 // LUCI identity (e.g. "user:<email>") who created the invocation. 126 // Typically, a LUCI service account (e.g. 127 // "user:cr-buildbucket@appspot.gserviceaccount.com"), but can also be a user 128 // (e.g. "user:johndoe@example.com"). 129 // 130 // Output only. 131 string created_by = 10 [ (google.api.field_behavior) = OUTPUT_ONLY ]; 132 133 // Full name of the resource that produced results in this invocation. 134 // See also https://aip.dev/122#full-resource-names 135 // Typical examples: 136 // - Swarming task: "//chromium-swarm.appspot.com/tasks/deadbeef" 137 // - Buildbucket build: "//cr-buildbucket.appspot.com/builds/1234567890". 138 string producer_resource = 11; 139 140 // Realm that the invocation exists under. 141 // See https://chromium.googlesource.com/infra/luci/luci-py/+/refs/heads/master/appengine/auth_service/proto/realms_config.proto 142 string realm = 12; 143 144 // Deprecated. Values specified here are ignored. 145 HistoryOptions history_options = 13; 146 147 // Arbitrary JSON object that contains structured, domain-specific properties 148 // of the invocation. 149 // 150 // The serialized size must be <= 4096 bytes. 151 google.protobuf.Struct properties = 14; 152 153 // The code sources which were tested by this invocation. 154 // This is used to index test results for test history, and for 155 // related analyses (e.g. culprit analysis / changepoint analyses). 156 // 157 // The sources specified here applies only to: 158 // - the test results directly contained in this invocation, and 159 // - any directly included invocations which set their source_spec.inherit to 160 // true. 161 // 162 // Clients should be careful to ensure the uploaded source spec is consistent 163 // between included invocations that upload the same test variants. 164 // Verdicts are associated with the sources of *any* of their constituent 165 // test results, so if there is inconsistency between included invocations, 166 // the position of the verdict becomes not well defined. 167 SourceSpec source_spec = 15; 168 169 // A user-specified baseline identifier that maps to a set of test variants. 170 // Often, this will be the source that generated the test result, such as the 171 // builder name for Chromium. For example, the baseline identifier may be 172 // try:linux-rel. The supported syntax for a baseline identifier is 173 // ^[a-z0-9\-_.]{1,100}:[a-zA-Z0-9\-_.\(\) ]{1,128}`$. This syntax was selected 174 // to allow <buildbucket bucket name>:<buildbucket builder name> as a valid 175 // baseline ID. 176 // See go/src/go.chromium.org/luci/buildbucket/proto/builder_common.proto for 177 // character lengths for buildbucket bucket name and builder name. 178 // 179 // Baselines are used to identify new tests; a subtraction between the set of 180 // test variants for a baseline in the Baselines table and test variants from 181 // a given invocation determines whether a test is new. 182 // 183 // The caller must have `resultdb.baselines.put` to be able to 184 // modify this field. 185 string baseline_id = 16; 186 } 187 188 // BigQueryExport indicates that results in this invocation should be exported 189 // to BigQuery after finalization. 190 message BigQueryExport { 191 // Name of the BigQuery project. 192 string project = 1 [ (google.api.field_behavior) = REQUIRED ]; 193 194 // Name of the BigQuery Dataset. 195 string dataset = 2 [ (google.api.field_behavior) = REQUIRED ]; 196 197 // Name of the BigQuery Table. 198 string table = 3 [ (google.api.field_behavior) = REQUIRED ]; 199 200 // TestResults indicates that test results should be exported. 201 message TestResults { 202 // Use predicate to query test results that should be exported to 203 // BigQuery table. 204 TestResultPredicate predicate = 1; 205 } 206 207 // TextArtifacts indicates that text artifacts should be exported. 208 message TextArtifacts { 209 // Use predicate to query artifacts that should be exported to 210 // BigQuery table. 211 // 212 // Sub-field predicate.content_type_regexp defaults to "text/.*". 213 ArtifactPredicate predicate = 1; 214 } 215 216 oneof result_type { 217 TestResults test_results = 4; 218 TextArtifacts text_artifacts = 6; 219 } 220 } 221 222 // HistoryOptions indicates how the invocations should be indexed, so that their 223 // results can be queried over a range of time or of commits. 224 // Deprecated: do not use. 225 message HistoryOptions { 226 // Set this to index the results by the containing invocation's create_time. 227 bool use_invocation_timestamp = 1; 228 229 // Set this to index by commit position. 230 // It's up to the creator of the invocation to set this consistently over 231 // time across the same test variant. 232 CommitPosition commit = 2; 233 } 234 235 // Specifies the source code that was tested in an invocation, either directly 236 // (via the sources field) or indirectly (via inherit_sources). 237 message SourceSpec { 238 // Specifies the source position that was tested. 239 // Either this or inherit_sources may be set, but not both. 240 Sources sources = 1; 241 242 // Specifies that the source position of the invocation is inherited 243 // from the parent invocation it is included in. 244 // 245 // # Use case 246 // This is useful in situations where the testing infrastructure deduplicates 247 // execution of tests on identical binaries (e.g. using swarming's task 248 // deduplication feature). 249 // 250 // Let A be the invocation for a swarming task that receives only a 251 // test binary as input, with task deduplication enabled. 252 // Let B be the invocation for a buildbucket build which built the 253 // binary from sources (or at the very least knew the sources) 254 // and triggered invocation A. 255 // Invocation B includes invocation A. 256 // 257 // By setting A's source_spec to inherit, and specifying the sources 258 // on invocation B, the test results in A will be associated with 259 // the sources specified on invocation B, when queried via invocation B. 260 // 261 // This allows further invocations B2, B3 ... BN to be created which also 262 // re-use the test results in A but associate them with possibly different 263 // sources when queried via B2 ... BN (this is valid so long as the sources 264 // produce a binary-identical testing input). 265 // 266 // # Multiple inclusion paths 267 // It is possible for an invocation A to be included in the reachable 268 // invocation graph for an invocation C in more than one way. 269 // 270 // For example, we may have: 271 // A -> B1 -> C 272 // A -> B2 -> C 273 // as two paths of inclusion. 274 // 275 // If A sets inherit to true, the commit position assigned to its 276 // test results will be selected via *one* of the paths of inclusion 277 // into C (i.e. from B1 or B2). 278 // 279 // However, which path is selected is not guaranteed, so if clients 280 // must include the same invocation multiple times, they should 281 // make the source position via all paths the same. 282 bool inherit = 2; 283 } 284 285 // Specifies the source code that was tested. 286 message Sources { 287 // The base version of code sources checked out. Mandatory. 288 // If necessary, we could add support for non-gitiles sources here in 289 // future, using a oneof statement. E.g. 290 // oneof system { 291 // GitilesCommit gitiles_commit = 1; 292 // SubversionRevision svn_revision = 4; 293 // ... 294 // } 295 GitilesCommit gitiles_commit = 1; 296 297 // The changelist(s) which were applied upon the base version of sources 298 // checked out. E.g. in commit queue tryjobs. 299 // 300 // At most 10 changelist(s) may be specified here. If there 301 // are more, only include the first 10 and set is_dirty. 302 repeated GerritChange changelists = 2; 303 304 // Whether there were any changes made to the sources, not described above. 305 // For example, a version of a dependency was upgraded before testing (e.g. 306 // in an autoroller recipe). 307 // 308 // Cherry-picking a changelist on top of the base checkout is not considered 309 // making the sources dirty as it is reported separately above. 310 bool is_dirty = 3; 311 }