go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/resultdb/proto/v1/resultdb.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/field_mask.proto";
    21  import "go.chromium.org/luci/resultdb/proto/v1/artifact.proto";
    22  import "go.chromium.org/luci/resultdb/proto/v1/invocation.proto";
    23  import "go.chromium.org/luci/resultdb/proto/v1/predicate.proto";
    24  import "go.chromium.org/luci/resultdb/proto/v1/test_result.proto";
    25  import "go.chromium.org/luci/resultdb/proto/v1/test_variant.proto";
    26  import "go.chromium.org/luci/resultdb/proto/v1/test_metadata.proto";
    27  
    28  option go_package = "go.chromium.org/luci/resultdb/proto/v1;resultpb";
    29  
    30  // Service to read test results.
    31  service ResultDB {
    32    // Retrieves an invocation.
    33    rpc GetInvocation(GetInvocationRequest) returns (Invocation) {};
    34  
    35    // == Test results ===========================================================
    36  
    37    // Retrieves a test result.
    38    rpc GetTestResult(GetTestResultRequest) returns (TestResult) {};
    39  
    40    // Retrieves test results for a parent invocation.
    41    //
    42    // Note: response does not contain test results of included invocations.
    43    // Use QueryTestResults instead.
    44    rpc ListTestResults(ListTestResultsRequest)
    45        returns (ListTestResultsResponse) {};
    46  
    47    // Retrieves a test exoneration.
    48    rpc GetTestExoneration(GetTestExonerationRequest) returns (TestExoneration) {
    49    };
    50  
    51    // Retrieves test exonerations for a parent invocation.
    52    //
    53    // Note: response does not contain test results of included invocations.
    54    // Use QueryTestExonerations instead.
    55    rpc ListTestExonerations(ListTestExonerationsRequest)
    56        returns (ListTestExonerationsResponse) {};
    57  
    58    // Retrieves test results from an invocation, recursively.
    59    // Supports invocation inclusions.
    60    // Supports advanced filtering.
    61    // Examples: go/resultdb-rpc#querytestresults
    62    rpc QueryTestResults(QueryTestResultsRequest)
    63        returns (QueryTestResultsResponse) {};
    64  
    65    // Retrieves test exonerations from an invocation.
    66    // Supports invocation inclusions.
    67    // Supports advanced filtering.
    68    rpc QueryTestExonerations(QueryTestExonerationsRequest)
    69        returns (QueryTestExonerationsResponse) {};
    70  
    71    // Retrieves the test result statistics of an invocation.
    72    // Currently supports total number of test results belong to the invocation,
    73    // directly and indirectly.
    74    rpc QueryTestResultStatistics(QueryTestResultStatisticsRequest)
    75        returns (QueryTestResultStatisticsResponse) {};
    76  
    77    // Calculate new test variants by running the difference between the tests
    78    // run in the given invocation against the submitted test history for the
    79    // source.
    80    rpc QueryNewTestVariants(QueryNewTestVariantsRequest)
    81        returns (QueryNewTestVariantsResponse) {};
    82  
    83    // == Artifacts =============================================================
    84  
    85    // Retrieves an artifact.
    86    rpc GetArtifact(GetArtifactRequest) returns (Artifact) {};
    87  
    88    // Retrieves artifacts for a parent invocation/testResult.
    89    //
    90    // Note: if the parent is an invocation, the response does not contain
    91    // artifacts of included invocations. Use QueryArtifacts instead.
    92    rpc ListArtifacts(ListArtifactsRequest) returns (ListArtifactsResponse) {};
    93  
    94    // Retrieves artifacts from an invocation, recursively.
    95    // Can retrieve artifacts of test results included in the invocation
    96    // directly or indirectly.
    97    // Supports invocation inclusions.
    98    rpc QueryArtifacts(QueryArtifactsRequest) returns (QueryArtifactsResponse) {};
    99  
   100    // Retrieves test variants from an invocation, recursively.
   101    // Supports invocation inclusions.
   102    rpc QueryTestVariants(QueryTestVariantsRequest) returns (QueryTestVariantsResponse) {};
   103  
   104    // Retrieves test variants from a single invocation, matching the specified
   105    // test IDs and hashes.
   106    rpc BatchGetTestVariants(BatchGetTestVariantsRequest) returns (BatchGetTestVariantsResponse) {};
   107  
   108    // Retrieves test metadata from a LUCI project, matching the predicate.
   109    rpc QueryTestMetadata(QueryTestMetadataRequest) returns (QueryTestMetadataResponse) {};
   110  }
   111  
   112  // A request message for GetInvocation RPC.
   113  message GetInvocationRequest {
   114    // The name of the invocation to request, see Invocation.name.
   115    string name = 1 [ (google.api.field_behavior) = REQUIRED ];
   116  }
   117  
   118  // A request message for GetTestResult RPC.
   119  message GetTestResultRequest {
   120    // The name of the test result to request, see TestResult.name.
   121    string name = 1 [ (google.api.field_behavior) = REQUIRED ];
   122  }
   123  
   124  // A request message for ListTestResults RPC.
   125  message ListTestResultsRequest {
   126    // Name of the invocation, e.g. "invocations/{id}".
   127    string invocation = 1 [ (google.api.field_behavior) = REQUIRED ];
   128  
   129    // The maximum number of test results to return.
   130    //
   131    // The service may return fewer than this value.
   132    // If unspecified, at most 100 test results will be returned.
   133    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   134    int32 page_size = 2;
   135  
   136    // A page token, received from a previous `ListTestResults` call.
   137    // Provide this to retrieve the subsequent page.
   138    //
   139    // When paginating, all other parameters provided to `ListTestResults` MUST
   140    // match the call that provided the page token.
   141    string page_token = 3;
   142  
   143    // Fields to include in the response.
   144    // If not set, the default mask is used where summary_html and tags are
   145    // excluded.
   146    // Test result names will always be included even if "name" is not a part of
   147    // the mask.
   148    google.protobuf.FieldMask read_mask = 4;
   149  }
   150  
   151  // A response message for ListTestResults RPC.
   152  message ListTestResultsResponse {
   153    // The test results from the specified invocation.
   154    repeated TestResult test_results = 1;
   155  
   156    // A token, which can be sent as `page_token` to retrieve the next page.
   157    // If this field is omitted, there were no subsequent pages at the time of
   158    // request.
   159    // If the invocation is not finalized, more results may appear later.
   160    string next_page_token = 2;
   161  }
   162  
   163  // A request message for GetTestExoneration RPC.
   164  message GetTestExonerationRequest {
   165    // The name of the test exoneration to request, see TestExoneration.name.
   166    string name = 1;
   167  }
   168  
   169  // A request message for ListTestExonerations RPC.
   170  message ListTestExonerationsRequest {
   171    // Name of the invocation, e.g. "invocations/{id}".
   172    string invocation = 1 [ (google.api.field_behavior) = REQUIRED ];
   173  
   174    // The maximum number of test exonerations to return.
   175    //
   176    // The service may return fewer than this value.
   177    // If unspecified, at most 100 test exonerations will be returned.
   178    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   179    int32 page_size = 2;
   180  
   181    // A page token, received from a previous `ListTestExonerations` call.
   182    // Provide this to retrieve the subsequent page.
   183    //
   184    // When paginating, all other parameters provided to `ListTestExonerations`
   185    // MUST match the call that provided the page token.
   186    string page_token = 3;
   187  }
   188  
   189  // A response message for ListTestExonerations RPC.
   190  message ListTestExonerationsResponse {
   191    // The test exonerations from the specified invocation.
   192    repeated TestExoneration test_exonerations = 1;
   193  
   194    // A token, which can be sent as `page_token` to retrieve the next page.
   195    // If this field is omitted, there were no subsequent pages at the time of
   196    // request.
   197    // If the invocation is not finalized, more results may appear later.
   198    string next_page_token = 2;
   199  }
   200  
   201  // A request message for QueryTestResults RPC.
   202  message QueryTestResultsRequest {
   203    // Retrieve test results included in these invocations, directly or indirectly
   204    // (via Invocation.included_invocations).
   205    //
   206    // Specifying multiple invocations is equivalent to querying one invocation
   207    // that includes these.
   208    repeated string invocations = 1;
   209  
   210    // A test result in the response must satisfy this predicate.
   211    TestResultPredicate predicate = 2;
   212  
   213    // The maximum number of test results to return.
   214    //
   215    // The service may return fewer than this value.
   216    // If unspecified, at most 100 test results will be returned.
   217    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   218    int32 page_size = 4;
   219  
   220    // A page token, received from a previous `QueryTestResults` call.
   221    // Provide this to retrieve the subsequent page.
   222    //
   223    // When paginating, all other parameters provided to `QueryTestResults` MUST
   224    // match the call that provided the page token.
   225    string page_token = 5;
   226  
   227    // Fields to include in the response.
   228    // If not set, the default mask is used where summary_html and tags are
   229    // excluded.
   230    // Test result names will always be included even if "name" is not a part of
   231    // the mask.
   232    google.protobuf.FieldMask read_mask = 6;
   233  }
   234  
   235  // A response message for QueryTestResults RPC.
   236  message QueryTestResultsResponse {
   237    // Matched test results.
   238    // Ordered by parent invocation ID, test ID and result ID.
   239    repeated TestResult test_results = 1;
   240  
   241    // A token, which can be sent as `page_token` to retrieve the next page.
   242    // If this field is omitted, there were no subsequent pages at the time of
   243    // request.
   244    string next_page_token = 2;
   245  }
   246  
   247  // A request message for QueryTestExonerations RPC.
   248  message QueryTestExonerationsRequest {
   249    // Retrieve test exonerations included in these invocations, directly or
   250    // indirectly (via Invocation.included_invocations).
   251    //
   252    // Specifying multiple invocations is equivalent to querying one invocation
   253    // that includes these.
   254    repeated string invocations = 1;
   255  
   256    // A test exoneration in the response must satisfy this predicate.
   257    TestExonerationPredicate predicate = 2
   258        [ (google.api.field_behavior) = REQUIRED ];
   259  
   260    // The maximum number of test exonerations to return.
   261    //
   262    // The service may return fewer than this value.
   263    // If unspecified, at most 100 test exonerations will be returned.
   264    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   265    int32 page_size = 4;
   266  
   267    // A page token, received from a previous `QueryTestExonerations` call.
   268    // Provide this to retrieve the subsequent page.
   269    //
   270    // When paginating, all other parameters provided to `QueryTestExonerations`
   271    // MUST match the call that provided the page token.
   272    string page_token = 5;
   273  }
   274  
   275  // A response message for QueryTestExonerations RPC.
   276  message QueryTestExonerationsResponse {
   277    // The test exonerations matching the predicate.
   278    // Ordered by parent invocation ID, test ID and exoneration ID.
   279    repeated TestExoneration test_exonerations = 1;
   280  
   281    // A token, which can be sent as `page_token` to retrieve the next page.
   282    // If this field is omitted, there were no subsequent pages at the time of
   283    // request.
   284    string next_page_token = 2;
   285  }
   286  
   287  // A request message for QueryTestResultStatistics RPC.
   288  message QueryTestResultStatisticsRequest {
   289    // Retrieve statistics of test result belong to these invocations,
   290    // directly or indirectly (via Invocation.included_invocations).
   291    //
   292    // Specifying multiple invocations is equivalent to requesting one invocation
   293    // that includes these.
   294    repeated string invocations = 1;
   295  }
   296  
   297  // A response message for QueryTestResultStatistics RPC.
   298  message QueryTestResultStatisticsResponse {
   299    // Total number of test results.
   300    int64 total_test_results = 1;
   301  }
   302  
   303  // A request message for GetArtifact RPC.
   304  message GetArtifactRequest {
   305    // The name of the artifact to request, see Artifact.name.
   306    string name = 1 [ (google.api.field_behavior) = REQUIRED ];
   307  }
   308  
   309  // A request message for ListArtifacts RPC.
   310  message ListArtifactsRequest {
   311    // Name of the parent, e.g. an invocation (see Invocation.name) or
   312    // a test result (see TestResult.name).
   313    string parent = 1 [ (google.api.field_behavior) = REQUIRED ];
   314  
   315    // The maximum number of artifacts to return.
   316    //
   317    // The service may return fewer than this value.
   318    // If unspecified, at most 100 artifacts will be returned.
   319    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   320    int32 page_size = 2;
   321  
   322    // A page token, received from a previous `ListArtifacts` call.
   323    // Provide this to retrieve the subsequent page.
   324    //
   325    // When paginating, all other parameters provided to `ListArtifacts` MUST
   326    // match the call that provided the page token.
   327    string page_token = 3;
   328  }
   329  
   330  // A response message for ListArtifacts RPC.
   331  message ListArtifactsResponse {
   332    // The artifacts from the specified parent.
   333    repeated Artifact artifacts = 1;
   334  
   335    // A token, which can be sent as `page_token` to retrieve the next page.
   336    // If this field is omitted, there were no subsequent pages at the time of
   337    // request.
   338    // If the invocation is not finalized, more results may appear later.
   339    string next_page_token = 2;
   340  }
   341  
   342  // A request message for QueryArtifacts RPC.
   343  message QueryArtifactsRequest {
   344    // Retrieve artifacts included in these invocations, directly or indirectly
   345    // (via Invocation.included_invocations and via contained test results).
   346    //
   347    // Specifying multiple invocations is equivalent to querying one invocation
   348    // that includes these.
   349    repeated string invocations = 1;
   350  
   351    // An artifact in the response must satisfy this predicate.
   352    ArtifactPredicate predicate = 2;
   353  
   354    // The maximum number of artifacts to return.
   355    //
   356    // The service may return fewer than this value.
   357    // If unspecified, at most 100 artifacts will be returned.
   358    // The maximum value is 1000; values above 1000 will be coerced to 1000.
   359    int32 page_size = 4;
   360  
   361    // A page token, received from a previous `QueryArtifacts` call.
   362    // Provide this to retrieve the subsequent page.
   363    //
   364    // When paginating, all other parameters provided to `QueryArtifacts` MUST
   365    // match the call that provided the page token.
   366    string page_token = 5;
   367  }
   368  
   369  // A response message for QueryArtifacts RPC.
   370  message QueryArtifactsResponse {
   371    // Matched artifacts.
   372    // First invocation-level artifacts, then test-result-level artifacts
   373    // ordered by parent invocation ID, test ID and artifact ID.
   374    repeated Artifact artifacts = 1;
   375  
   376    // A token, which can be sent as `page_token` to retrieve the next page.
   377    // If this field is omitted, there were no subsequent pages at the time of
   378    // request.
   379    string next_page_token = 2;
   380  }
   381  
   382  // A request message for QueryTestVariants RPC.
   383  // Next id: 9.
   384  message QueryTestVariantsRequest {
   385    // Retrieve test variants included in these invocations, directly or indirectly
   386    // (via Invocation.included_invocations).
   387    //
   388    // Specifying multiple invocations is equivalent to querying one invocation
   389    // that includes these.
   390    repeated string invocations = 2;
   391  
   392    // A test variant must satisfy this predicate.
   393    TestVariantPredicate predicate = 6;
   394  
   395    // The maximum number of test results to be included in a test variant.
   396    //
   397    // If a test variant has more results than the limit, the remaining results
   398    // will not be returned.
   399    // If unspecified, at most 10 results will be included in a test variant.
   400    // The maximum value is 100; values above 100 will be coerced to 100.
   401    int32 result_limit = 8;
   402  
   403    // The maximum number of test variants to return.
   404    //
   405    // The service may return fewer than this value.
   406    // If unspecified, at most 100 test variants will be returned.
   407    // The maximum value is 10,000; values above 10,000 will be coerced to 10,000.
   408    int32 page_size = 4;
   409  
   410    // A page token, received from a previous `QueryTestVariants` call.
   411    // Provide this to retrieve the subsequent page.
   412    //
   413    // When paginating, all other parameters provided to `QueryTestVariants` MUST
   414    // match the call that provided the page token.
   415    string page_token = 5;
   416  
   417    // Fields to include in the response.
   418    // If not set, the default mask is used where all fields are included.
   419    //
   420    // The following fields in results.*.result will NEVER be included even when
   421    // specified:
   422    // * test_id
   423    // * variant_hash
   424    // * variant
   425    // * test_metadata
   426    // Those values can be found in the parent test variant objects.
   427    //
   428    // The following fields will ALWAYS be included even when NOT specified:
   429    // * test_id
   430    // * variant_hash
   431    // * status
   432    google.protobuf.FieldMask read_mask = 7;
   433  }
   434  
   435  // A response message for QueryTestVariants RPC.
   436  message QueryTestVariantsResponse {
   437    // Matched test variants.
   438    // Ordered by TestVariantStatus, test_id, then variant_hash
   439    repeated TestVariant test_variants = 1;
   440  
   441    // A token, which can be sent as `page_token` to retrieve the next page.
   442    // If this field is omitted, there were no subsequent pages at the time of
   443    // request.
   444    string next_page_token = 2;
   445  
   446    // The code sources tested by the returned test variants. The sources are keyed
   447    // by an ID which allows them to be cross-referenced from TestVariant.sources_id.
   448    //
   449    // The sources are returned via this map instead of directly on the TestVariant
   450    // to avoid excessive response size. Each source message could be up to a few
   451    // kilobytes and there are usually no more than a handful of different sources
   452    // tested in an invocation, so deduplicating them here reduces response size.
   453    map<string, Sources> sources = 3;
   454  }
   455  
   456  // A request message for BatchGetTestVariants RPC.
   457  message BatchGetTestVariantsRequest {
   458    message TestVariantIdentifier {
   459      // The unique identifier of the test in a LUCI project. See the comment on
   460      // TestResult.test_id for full documentation.
   461      string test_id = 1 [ (google.api.field_behavior) = REQUIRED ];
   462  
   463      // Hash of the variant. See the comment on TestResult.variant_hash for full
   464      // documentation.
   465      string variant_hash = 2 [ (google.api.field_behavior) = REQUIRED ];
   466    }
   467  
   468    // Name of the invocation that the test variants are in.
   469     string invocation = 1;
   470  
   471    // A list of test IDs and variant hashes, identifying the requested test
   472    // variants. Size is limited to 500. Any request for more than 500 variants
   473    // will return an error.
   474    repeated TestVariantIdentifier test_variants = 2;
   475  
   476    // The maximum number of test results to be included in a test variant.
   477    //
   478    // If a test variant has more results than the limit, the remaining results
   479    // will not be returned.
   480    // If unspecified, at most 10 results will be included in a test variant.
   481    // The maximum value is 100; values above 100 will be coerced to 100.
   482    int32 result_limit = 3;
   483  }
   484  
   485  // A response message for BatchGetTestVariants RPC.
   486  message BatchGetTestVariantsResponse {
   487    // Test variants matching the requests. Any variants that weren't found are
   488    // omitted from the response. Clients shouldn't rely on the ordering of this
   489    // field, as no particular order is guaranteed.
   490    repeated TestVariant test_variants = 1;
   491  
   492    // The code sources tested by the returned test variants. The sources are keyed
   493    // by an ID which allows them to be cross-referenced from TestVariant.sources_id.
   494    //
   495    // The sources are returned via this map instead of directly on the TestVariant
   496    // to avoid excessive response size. Each source message could be up to a few
   497    // kilobytes and there are usually no more than a handful of different sources
   498    // tested in an invocation, so deduplicating them here reduces response size.
   499    map<string, Sources> sources = 2;
   500  }
   501  
   502  // A request message for QueryTestMetadata RPC.
   503  message QueryTestMetadataRequest {
   504    // The LUCI Project to query.
   505    string project = 1 [(google.api.field_behavior) = REQUIRED];
   506  
   507    // Filters to apply to the returned test metadata.
   508    TestMetadataPredicate predicate = 2;
   509  
   510    // The maximum number of test metadata entries to return.
   511    //
   512    // The service may return fewer than this value.
   513    // If unspecified, at most 1000 test metadata entries will be returned.
   514    // The maximum value is 100K; values above 100K will be coerced to 100K.
   515    int32 page_size = 3;
   516  
   517    // A page token, received from a previous `QueryTestMetadata` call.
   518    // Provide this to retrieve the subsequent page.
   519    //
   520    // When paginating, all other parameters provided to `QueryTestMetadata` MUST
   521    // match the call that provided the page token.
   522    string page_token = 4;
   523  }
   524  
   525  // A response message for QueryTestMetadata RPC.
   526  message QueryTestMetadataResponse {
   527    // The matched testMetadata.
   528    repeated TestMetadataDetail testMetadata = 1;
   529  
   530    // A token, which can be sent as `page_token` to retrieve the next page.
   531    // If this field is omitted, there were no subsequent pages at the time of
   532    // request.
   533    string next_page_token = 2;
   534  }
   535  
   536  // A request message for QueryNewTestVariants RPC.
   537  // To use this RPC, callers need:
   538  // - resultdb.baselines.get in the realm the <baseline_project>:@project, where
   539  //   baseline_project is the LUCI project that contains the baseline.
   540  // - resultdb.testResults.list in the realm of the invocation which is being
   541  //   queried.
   542  message QueryNewTestVariantsRequest {
   543    // Name of the invocation, e.g. "invocations/{id}".
   544    string invocation = 1 [ (google.api.field_behavior) = REQUIRED ];
   545  
   546    // The baseline to compare test variants against, to determine if they are new.
   547    // e.g. “projects/{project}/baselines/{baseline_id}”.
   548    // For example, in the project "chromium", the baseline_id may be
   549    // "try:linux-rel".
   550    string baseline = 2 [ (google.api.field_behavior) = REQUIRED ];
   551  }
   552  
   553  // A response message for QueryNewTestVariants RPC.
   554  message QueryNewTestVariantsResponse {
   555  
   556    // Represents a new test, which contains minimal information to uniquely identify a TestVariant.
   557    message NewTestVariant {
   558      // A unique identifier of the test in a LUCI project.
   559      // Regex: ^[[::print::]]{1,256}$
   560      //
   561      // Refer to TestResult.test_id for details.
   562      string test_id = 1;
   563  
   564      // Hash of the variant.
   565      // hex(sha256(sorted(''.join('%s:%s\n' for k, v in variant.items())))).
   566      string variant_hash = 2;
   567    }
   568  
   569    // Indicates whether the baseline has been populated with at least 72 hours
   570    // of data and the results can be relied upon.
   571    bool is_baseline_ready = 1;
   572  
   573  
   574    // Test variants that are new, meaning that they have not been part of
   575    // a submitted run prior.
   576    repeated NewTestVariant new_test_variants = 2;
   577  }