go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/resultdb/proto/v1/recorder.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/empty.proto"; 21 import "google/protobuf/field_mask.proto"; 22 import "go.chromium.org/luci/resultdb/proto/v1/artifact.proto"; 23 import "go.chromium.org/luci/resultdb/proto/v1/invocation.proto"; 24 import "go.chromium.org/luci/resultdb/proto/v1/test_result.proto"; 25 26 option go_package = "go.chromium.org/luci/resultdb/proto/v1;resultpb"; 27 28 // Service to record test results. 29 // 30 // CreateInvocation response includes a metadata key "update-token". 31 // It MUST be passed to all other mutation RPCs, such as CreateTestResult. 32 // Otherwise the request will fail with UNAUTHENTICATED error code. 33 // 34 // RPCs that mutate an invocation return FAILED_PRECONDITION error code if the 35 // invocation is finalized. 36 service Recorder { 37 38 // == Invocations ============================================================ 39 40 // Creates a new invocation. 41 // The request specifies the invocation id and its contents. 42 // 43 // The response header metadata contains "update-token" required for future 44 // updates, including finalization. 45 // 46 // If invocation with the given ID already exists, returns ALREADY_EXISTS 47 // error code. 48 rpc CreateInvocation(CreateInvocationRequest) returns (Invocation) {}; 49 50 // Creates multiple invocations in a single rpc. 51 // 52 // The response header metadata contains a multi-valued "update-token" 53 // required for future updates, including finalization. The tokens will be 54 // given in the same order as BatchCreateInvocationRequest.requests. 55 rpc BatchCreateInvocations(BatchCreateInvocationsRequest) 56 returns (BatchCreateInvocationsResponse) {}; 57 58 // Updates an existing non-finalized invocation. 59 rpc UpdateInvocation(UpdateInvocationRequest) returns (Invocation) {}; 60 61 // Transitions the given invocation to the state FINALIZED. 62 rpc FinalizeInvocation(FinalizeInvocationRequest) returns (Invocation) {}; 63 64 // Updates inclusions for a non-finalized invocation. 65 rpc UpdateIncludedInvocations(UpdateIncludedInvocationsRequest) 66 returns (google.protobuf.Empty) {}; 67 68 // Recursively marks all test variants associated with the invocation as 69 // submitted, merging them into the invocation's associated baseline. 70 rpc MarkInvocationSubmitted(MarkInvocationSubmittedRequest) 71 returns (google.protobuf.Empty) {}; 72 73 // == Test results =========================================================== 74 75 // Appends a test result to a non-finalized invocation. 76 rpc CreateTestResult(CreateTestResultRequest) returns (TestResult) {}; 77 // Atomically appends a batch of test results to a non-finalized invocation. 78 rpc BatchCreateTestResults(BatchCreateTestResultsRequest) 79 returns (BatchCreateTestResultsResponse) {}; 80 81 // Appends a test exoneration to a non-finalized invocation. 82 rpc CreateTestExoneration(CreateTestExonerationRequest) 83 returns (TestExoneration) {}; 84 // Atomically appends a batch of test exonerations to a non-finalized 85 // invocation. 86 rpc BatchCreateTestExonerations(BatchCreateTestExonerationsRequest) 87 returns (BatchCreateTestExonerationsResponse) {}; 88 89 // == Artifacts ============================================================== 90 91 // Create multiple artifacts. 92 // 93 // An artifact can be either invocation-level or test-result-level. 94 // See Artifact.name for more info. 95 rpc BatchCreateArtifacts(BatchCreateArtifactsRequest) 96 returns (BatchCreateArtifactsResponse) {}; 97 } 98 99 // == Invocations ============================================================== 100 101 // A request message for CreateInvocation. 102 message CreateInvocationRequest { 103 // Invocation identifier, becomes a part of the invocation.name. 104 // LUCI systems MAY create invocations with nicely formatted IDs, such as 105 // "build-1234567890". All other clients MUST use GUIDs. 106 // 107 // Regex: ^[a-z][a-z0-9_\-]*$. 108 string invocation_id = 1 [ (google.api.field_behavior) = REQUIRED ]; 109 110 // Invocation data to insert. 111 Invocation invocation = 2; 112 113 // A unique identifier for this request. Restricted to 36 ASCII characters. 114 // A random UUID is recommended. 115 // This request is only idempotent if a `request_id` is provided. 116 string request_id = 3; 117 } 118 119 // A request message for BatchCreateInvocations 120 message BatchCreateInvocationsRequest { 121 // requests[i].request_id MUST be either empty or equal to request_id in 122 // this message. 123 // 124 // Up to 500 requests. 125 repeated CreateInvocationRequest requests = 1; 126 127 // A unique identifier for this request. Restricted to 36 ASCII characters. 128 // A random UUID is recommended. 129 // This request is only idempotent if a `request_id` is provided, so it is 130 // strongly recommended to populate this field. 131 string request_id = 2; 132 } 133 134 135 // A response message for BatchCreateInvocations RPC. 136 message BatchCreateInvocationsResponse { 137 // Invocations created. 138 repeated Invocation invocations = 1; 139 140 // One token per each created invocation. 141 // These are passed in the response instead of as metadata, because large 142 // batches increase the size of the response headers beyond allowed limits and 143 // cause failures like crbug.com/1064496 144 // update_tokens[i] corresponds to invocations[i]. 145 // *Do not log these values*. 146 repeated string update_tokens = 2; 147 } 148 149 150 // A request message for UpdateInvocation RPC. 151 message UpdateInvocationRequest { 152 // Invocation to update. 153 Invocation invocation = 1 [ (google.api.field_behavior) = REQUIRED ]; 154 155 // The list of fields to be updated. 156 google.protobuf.FieldMask update_mask = 2; 157 } 158 159 // A request message for FinalizeInvocation RPC. 160 message FinalizeInvocationRequest { 161 // Name of the invocation to finalize. 162 string name = 1 [ (google.api.field_behavior) = REQUIRED ]; 163 } 164 165 // A request message for UpdateIncludedInvocations RPC. 166 message UpdateIncludedInvocationsRequest { 167 // Name of the invocation to add/remove inclusions to/from, 168 // see Invocation.name. 169 // For example, name of the buildbucket build invocation that should include 170 // a swarming task invocation. 171 string including_invocation = 1 [ (google.api.field_behavior) = REQUIRED ]; 172 173 // Names of the invocations to include, see Invocation.name. 174 // If any of these invocations are already included, they will be silently 175 // ignored for idempotency. 176 repeated string add_invocations = 2; 177 178 // Names of the previously included invocations to remove, see 179 // Invocation.name. 180 // If any of these invocations are not included already, they will be silently 181 // ignored for idempotency. 182 repeated string remove_invocations = 3; 183 } 184 185 // A request message for MarkInvocationSubmitted RPC. 186 // To use this RPC, callers need: 187 // - resultdb.invocations.setSubmitted in the realm the <project>:@project, where 188 // project is the project of the nominated invocation. 189 message MarkInvocationSubmittedRequest { 190 // Name of the invocation, e.g. "invocations/{id}". 191 string invocation = 1 [ (google.api.field_behavior) = REQUIRED ]; 192 } 193 194 195 // A request message for CreateTestResult RPC. 196 message CreateTestResultRequest { 197 // Name of the parent invocation, see Invocation.name. 198 string invocation = 1 [ (google.api.field_behavior) = REQUIRED ]; 199 200 // The test result to create. 201 // Test id and result id are used to dedupe requests, i.e. 202 // if a test result with the same test id and result id already exists in 203 // the invocation, then the requests succeeds as opposed to returns with 204 // ALREADY_EXISTS error. 205 TestResult test_result = 2 [ (google.api.field_behavior) = REQUIRED ]; 206 207 // A unique identifier for this request. Restricted to 36 ASCII characters. 208 // A random UUID is recommended. 209 // This request is only idempotent if a `request_id` is provided, so it is 210 // strongly recommended to populate this field. 211 // 212 // Impl note: this field is used to compute the spanner-level result id, which 213 // will encode tuple (request_id, index_of_request)", where 214 // - request_id is a random GUID if not provided by the user 215 // - index_of_request is 0 in CreateTestResult RPC, or index of the request 216 // in BatchCreateTestResultsRequest in the batch RPC. 217 // TODO(jchinlee): remove this impl note when it is converted into code. 218 string request_id = 3; 219 } 220 221 // == Test results ============================================================= 222 223 // A request message for BatchCreateTestResults RPC. 224 message BatchCreateTestResultsRequest { 225 // Name of the parent invocation, see Invocation.name. 226 string invocation = 1 [ (google.api.field_behavior) = REQUIRED ]; 227 228 // Requests to create test results. 229 // requests[i].invocation MUST be either empty or equal to invocation in this 230 // message. 231 // requests[i].request_id MUST be either empty or equal to request_id in 232 // this message. 233 // 234 // Up to 500 requests. 235 repeated CreateTestResultRequest requests = 2; 236 237 // A unique identifier for this request. Restricted to 36 ASCII characters. 238 // A random UUID is recommended. 239 // This request is only idempotent if a `request_id` is provided, so it is 240 // strongly recommended to populate this field. 241 // 242 string request_id = 3; 243 } 244 245 // A response message for BatchCreateTestResults RPC. 246 message BatchCreateTestResultsResponse { 247 // Test results created. 248 repeated TestResult test_results = 1; 249 } 250 251 // A request message for CreateTestExoneration RPC. 252 message CreateTestExonerationRequest { 253 // Name of the parent invocation, see Invocation.name. 254 string invocation = 1 [ (google.api.field_behavior) = REQUIRED ]; 255 256 // The TestExoneration to create. 257 TestExoneration test_exoneration = 2 258 [ (google.api.field_behavior) = REQUIRED ]; 259 260 // A unique identifier for this request. Restricted to 36 ASCII characters. 261 // A random UUID is recommended. 262 // This request is only idempotent if a `request_id` is provided. 263 string request_id = 3; 264 } 265 266 // A request message for BatchCreateTestExonerations RPC. 267 message BatchCreateTestExonerationsRequest { 268 // Name of the parent invocation, see Invocation.name. 269 string invocation = 1 [ (google.api.field_behavior) = REQUIRED ]; 270 271 // Requests to create TestExonerations. 272 // requests[i].invocation MUST be either empty or equal to invocation in this 273 // message. 274 // requests[i].request_id MUST be either empty or equal to request_id in 275 // this message. 276 // 277 // Up to 500 requests. 278 repeated CreateTestExonerationRequest requests = 2; 279 280 // A unique identifier for this request. Restricted to 36 ASCII characters. 281 // A random UUID is recommended. 282 // This request is only idempotent if a `request_id` is provided, so it is 283 // strongly recommended to populate this field. 284 string request_id = 3; 285 } 286 287 // A response message for BatchCreateTestExonerations RPC. 288 message BatchCreateTestExonerationsResponse { 289 // Test exonerations created. 290 repeated TestExoneration test_exonerations = 1; 291 } 292 293 // == Artifacts ================================================================ 294 295 // A request message for CreateArtifactRequest. 296 message CreateArtifactRequest { 297 // Name of the parent resource where the artifact will be created. 298 // 299 // For invocation-level artifacts, it is the invocation name. 300 // For test-result-level artifacts, it is the TestResult name. 301 string parent = 1 [ (google.api.field_behavior) = REQUIRED ]; 302 303 // Artifact to upload. 304 // The length of the artifact contents MUST be <= 512KiB. 305 // artifact.artifact_id MUST be set. 306 // artifact.name will be ignored. 307 Artifact artifact = 2 [ (google.api.field_behavior) = REQUIRED ]; 308 } 309 310 // A request message for BatchCreateArtifactsRequest. 311 message BatchCreateArtifactsRequest { 312 // Requests to create Artifacts. 313 // The sum of the content lengths MUST be <= 10MiB. 314 // The parents of all the requests must be derived from the same invocation. 315 // 316 // Up to 500 requests. 317 repeated CreateArtifactRequest requests = 2; 318 } 319 320 message BatchCreateArtifactsResponse { 321 // Artifacts created. 322 repeated Artifact artifacts = 1; 323 }