go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/milo/proto/v1/rpc.proto (about)

     1  // Copyright 2020 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.milo.v1;
    18  
    19  import "go.chromium.org/luci/common/proto/git/commit.proto";
    20  import "go.chromium.org/luci/buildbucket/proto/build.proto";
    21  import "go.chromium.org/luci/buildbucket/proto/builder_common.proto";
    22  import "go.chromium.org/luci/buildbucket/proto/common.proto";
    23  import "go.chromium.org/luci/milo/proto/projectconfig/project.proto";
    24  
    25  option go_package = "go.chromium.org/luci/milo/proto/v1;milopb";
    26  
    27  // Service to query data on the Milo server.
    28  //
    29  // Note: this is private API and should only be used by Milo apps. Breaking
    30  // changes might be introduced without notice.
    31  // Please contact chops-luci-test@ if your code needs to depend on this service.
    32  service MiloInternal {
    33    // Retrieves blamelist of a build.
    34    //
    35    // The blamelist of a build is defined as [end_commit, start_commit)
    36    // end_commit is the Gitiles commit of the build (specified in gitiles
    37    // buildset tag).
    38    // start_commit is the closest ancestor commit with an associated build that
    39    // is from the same builder and is not expired, cancelled, or infra-failed.
    40    rpc QueryBlamelist(QueryBlamelistRequest) returns (QueryBlamelistResponse) {};
    41  
    42    // Retrieves a list of projects.
    43    rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse) {};
    44  
    45    // Gets the project config.
    46    //
    47    // Return the config of the project.
    48    rpc GetProjectCfg(GetProjectCfgRequest) returns (luci.milo.projectconfig.Project) {};
    49  
    50    // Retrieves the recent, finished builds of a builder.
    51    rpc QueryRecentBuilds(QueryRecentBuildsRequest) returns (QueryRecentBuildsResponse) {};
    52  
    53    // Retrieves a list of builders in a project or a builder group.
    54    rpc ListBuilders(ListBuildersRequest) returns (ListBuildersResponse) {};
    55  
    56    // Get the statistics associated with a builder.
    57    rpc QueryBuilderStats(QueryBuilderStatsRequest) returns (BuilderStats) {};
    58  
    59    // Check whether the users has the specified permissions in the given realm.
    60    rpc BatchCheckPermissions(BatchCheckPermissionsRequest) returns (BatchCheckPermissionsResponse) {};
    61  
    62    // Retrieves a list of consoles.
    63    rpc QueryConsoles(QueryConsolesRequest) returns (QueryConsolesResponse) {};
    64  
    65    // Retrieves a list of consoles with latest snapshots.
    66    rpc QueryConsoleSnapshots(QueryConsoleSnapshotsRequest) returns (QueryConsoleSnapshotsResponse) {};
    67  }
    68  
    69  // A request message for `QueryBlamelist` RPC.
    70  message QueryBlamelistRequest {
    71    // The Gitiles commit of the build.
    72    //
    73    // This defines the end_commit of the blamelist.
    74    // It should be set to the output Gitiles commit of the build.
    75    // Input Gitiles commit should be used when output gitiles commit is not
    76    // available.
    77    buildbucket.v2.GitilesCommit gitiles_commit = 1;
    78  
    79    // The context builder of the blamelist.
    80    //
    81    // The start commit of the blamelist is the closest ancestor commit with an
    82    // associated build that is from the same builder and is not expired,
    83    // cancelled, or infra-failed.
    84    buildbucket.v2.BuilderID builder = 2;
    85  
    86    // Optional. The maximum number of commits to return.
    87    //
    88    // The service may return fewer than this value.
    89    // If unspecified, at most 100 commits will be returned.
    90    // The maximum value is 1000; values above 1000 will be coerced to 1000.
    91    int32 page_size = 3;
    92  
    93    // Optional. A page token, received from a previous `QueryBlamelist` call.
    94    // Provide this to retrieve the subsequent page.
    95    //
    96    // When paginating, all parameters provided to `QueryBlamelist`, with the
    97    // exception of page_size and page_token, must match the call that provided
    98    // the page token.
    99    string page_token = 4;
   100  
   101    // This field is unused.
   102    //
   103    // TODO(crbugs/1047893): remove this field in the once no clients depends on
   104    // this.
   105    bool multi_project_support = 5;
   106  }
   107  
   108  // A response message for QueryBlamelist RPC.
   109  message QueryBlamelistResponse {
   110    // The commits from the blamelist of the build, in reverse chronological
   111    // order.
   112    repeated git.Commit commits = 1;
   113  
   114    // A token that can be sent as `page_token` to retrieve the next page.
   115    // If this field is omitted, there are no subsequent pages.
   116    string next_page_token = 2;
   117  
   118    // The repo commit immediately preceding |commits|. Useful for creating
   119    // git log queries, which are exclusive of the first commit.
   120    // Unset when |commits| includes the first commit in the repository.
   121    git.Commit preceding_commit = 3;
   122  }
   123  
   124  // A stateless page token for QueryBlamelist RPC.
   125  message QueryBlamelistPageToken {
   126    // The first commit in the next page.
   127    string next_commit_id = 2;
   128  }
   129  
   130  // A request message for `ListProjects` RPC.
   131  message ListProjectsRequest {
   132    // Optional. The maxium number of projects to return.
   133    //
   134    // The service may return fewer than this value.
   135    // If unspecified, at most 100 projects will be returned.
   136    // The maximum value is 10000; values above 10000 will be coerced to 10000.
   137    int32 page_size = 1;
   138  
   139    // Optional. A page token, received from a previous `ListProjects`
   140    // call. Provide this to retrieve the subsequent page.
   141    //
   142    // When paginating, all parameters provided to `ListProjects`, with the
   143    // exception of page_size and page_token, must match the call that provided
   144    // the page token.
   145    string page_token = 2;
   146  }
   147  
   148  // A response message for `ListProjects` RPC.
   149  message ListProjectsResponse {
   150    // A list of matched projects.
   151    //
   152    // Projects are ordered by their string ID
   153    repeated ProjectListItem projects = 1;
   154  
   155    // A token that can be sent as `page_token` to retrieve the next page.
   156    // If this field is omitted, there are no subsequent pages.
   157    string next_page_token = 2;
   158  }
   159  
   160  // A single project in a ListProjectsResponse.
   161  message ProjectListItem {
   162    // The project id.
   163    string id = 1;
   164  
   165    // The url of the project logo.
   166    string logo_url = 2;
   167  }
   168  
   169  // A stateless page token for `ListProjects` RPC.
   170  message ListProjectsPageToken {
   171    // The index of the next project from all projects.
   172    int32 next_project_index = 3;
   173  }
   174  
   175  message GetProjectCfgRequest {
   176    // The project name.
   177    string project = 1;
   178  }
   179  
   180  // A request message for `QueryRecentBuilds` RPC.
   181  message QueryRecentBuildsRequest {
   182    // The builder to query the build history from.
   183    buildbucket.v2.BuilderID builder = 1;
   184  
   185    // Optional. The maxium number of builds to return.
   186    //
   187    // The service may return fewer than this value.
   188    // If unspecified, at most 25 builds will be returned.
   189    // The maximum value is 100; values above 100 will be coerced to 100.
   190    int32 page_size = 2;
   191  
   192    // Optional. A page token, received from a previous `QueryRecentBuilds`
   193    // call. Provide this to retrieve the subsequent page.
   194    //
   195    // When paginating, all parameters provided to `QueryRecentBuilds`, with
   196    // the exception of page_size and page_token, must match the call that
   197    // provided the page token.
   198    string page_token = 3;
   199  }
   200  
   201  // A response message for `QueryRecentBuilds` RPC.
   202  message QueryRecentBuildsResponse {
   203    // Recent builds. Ordered by `CreateTime`.
   204    // Only Id, Builder, Number, CreateTime, Status, Critical are populated.
   205    repeated buildbucket.v2.Build builds = 1;
   206  
   207    // A token that can be sent as `page_token` to retrieve the next page.
   208    // If this field is omitted, there are no subsequent pages.
   209    string next_page_token = 2;
   210  }
   211  
   212  // A request message for `ListBuilders` RPC.
   213  message ListBuildersRequest {
   214    // Required only when `group` is specified. The project to query the builders
   215    // from.
   216    //
   217    // When specified, query all builders in the project as well as any external
   218    // builders  referenced by the consoles in the project.
   219    // When omitted, query all builders in any project.
   220    string project = 1;
   221  
   222    // Optional. The group/console to query the builders from.
   223    //
   224    // When omitted, all builders from the project is returned. Including all
   225    // builders defined in the consoles, builder groups, and buildbucket.
   226    string group = 2;
   227  
   228    // Optional. The maxium number of builders to return.
   229    //
   230    // The service may return fewer than this value.
   231    // If unspecified, at most 100 builders will be returned.
   232    // The maximum value is 10000; values above 10000 will be coerced to 10000.
   233    int32 page_size = 3;
   234  
   235    // Optional. A page token, received from a previous `ListBuilders`
   236    // call. Provide this to retrieve the subsequent page.
   237    //
   238    // When paginating, all parameters provided to `ListBuilders`, with the
   239    // exception of page_size and page_token, must match the call that provided
   240    // the page token.
   241    string page_token = 4;
   242  }
   243  
   244  // A response message for `ListBuilders` RPC.
   245  message ListBuildersResponse {
   246    // A list of matched builders.
   247    //
   248    // Builders are ordered by their canonical string ID
   249    // (i.e. "{project}/{bucket}/{builder}") with the exception that builders from
   250    // `ListBuildersRequest.project` always come before builders from other
   251    // projects.
   252    // Only builder IDs are populated for now.
   253    repeated buildbucket.v2.BuilderItem builders = 1;
   254  
   255    // A token that can be sent as `page_token` to retrieve the next page.
   256    // If this field is omitted, there are no subsequent pages.
   257    string next_page_token = 2;
   258  }
   259  
   260  // A stateless page token for `ListBuilders` RPC.
   261  message ListBuildersPageToken {
   262    // The index of the next builder from all cached builders from buildbucket.
   263    //
   264    // Should not coexist with `NextMiloBuilderIndex`.
   265    int32 next_buildbucket_builder_index = 3;
   266    // The index of the next builder from Milo project definition.
   267    //
   268    // Should not coexist with `NextBuildbucketBuilderIndex`.
   269    int32 next_milo_builder_index = 2;
   270  }
   271  
   272  // A request message for `QueryBuilderStats` RPC.
   273  message QueryBuilderStatsRequest {
   274    // The builder to query the stats from.
   275    buildbucket.v2.BuilderID builder = 1;
   276  }
   277  
   278  // A message that contains some basic stats of a builder.
   279  message BuilderStats {
   280    // The builder that the stats belongs to.
   281    buildbucket.v2.BuilderID builder = 1;
   282  
   283    // The number of pending builds associated with the builder.
   284    int32 pending_builds_count = 2;
   285  
   286    // The number of running builds associated with the builder.
   287    int32 running_builds_count = 3;
   288  }
   289  
   290  // A request message for `BatchCheckPermissions` RPC.
   291  message BatchCheckPermissionsRequest {
   292    // Required. The realm to check the permissions against.
   293    string realm = 1;
   294  
   295    // String representation of the permissions.
   296    //
   297    // Permissions must have the following format: `<service>.<subject>.<verb>`.
   298    repeated string permissions = 2;
   299  }
   300  
   301  // A response message for `BatchCheckPermissions` RPC.
   302  message BatchCheckPermissionsResponse {
   303    // A map of permission check results.
   304    //
   305    // The key is the permission name and the value is whether the user has the
   306    // permission.
   307    map<string, bool> results = 1;
   308  }
   309  
   310  // Represents a function Console -> bool.
   311  // Empty message matches all consoles.
   312  message ConsolePredicate {
   313    // A console must belong to this project.
   314    string project = 2;
   315  
   316    // A console must include this builder.
   317    buildbucket.v2.BuilderID builder = 1;
   318  }
   319  
   320  message QueryConsolesRequest {
   321    // A console in the response must satisfy this predicate.
   322    ConsolePredicate predicate = 1;
   323  
   324    // Optional. The maxium number of consoles to return.
   325    //
   326    // The service may return fewer than this value.
   327    // If unspecified, at most 25 consoles will be returned.
   328    // The maximum value is 100; values above 100 will be coerced to 100.
   329    int32 page_size = 2;
   330  
   331    // Optional. A page token, received from a previous `ListBuilders`
   332    // call. Provide this to retrieve the subsequent page.
   333    //
   334    // When paginating, all parameters provided to `ListBuilders`, with the
   335    // exception of page_size and page_token, must match the call that provided
   336    // the page token.
   337    string page_token = 3;
   338  }
   339  
   340  message QueryConsolesResponse {
   341    // A list of matched consoles.
   342    repeated luci.milo.projectconfig.Console consoles = 1;
   343  
   344    // A token that can be sent as `page_token` to retrieve the next page.
   345    // If this field is omitted, there are no subsequent pages.
   346    string next_page_token = 2;
   347  }
   348  
   349  message QueryConsoleSnapshotsRequest {
   350    // A console in the response must satisfy this predicate.
   351    // `predicate.project` is required.
   352    ConsolePredicate predicate = 1;
   353  
   354    // Optional. The maximum number of consoles to return.
   355    //
   356    // The service may return fewer than this value.
   357    // If unspecified, at most 25 consoles will be returned.
   358    // The maximum value is 100; values above 100 will be coerced to 100.
   359    int32 page_size = 2;
   360  
   361    // Optional. A page token, received from a previous `QueryConsoleSnapshots`
   362    // call. Provide this to retrieve the subsequent page.
   363    //
   364    // When paginating, all parameters provided to `QueryConsoleSnapshots`, with
   365    // the exception of page_size and page_token, must match the call that
   366    // provided the page token.
   367    string page_token = 3;
   368  }
   369  
   370  message BuilderSnapshot {
   371    // The builder this snapshot belongs to.
   372    buildbucket.v2.BuilderID builder = 1;
   373  
   374    // The latest build associated with the builder at the time the snapshot is
   375    // taken. Nil if there's no associated build.
   376    buildbucket.v2.Build build = 2;
   377  }
   378  
   379  message ConsoleSnapshot {
   380    // The console this snapshot belongs to.
   381    luci.milo.projectconfig.Console console = 1;
   382  
   383    // The snapshots of all the builders in the console.
   384    // In the same order as `console.builders`.
   385    repeated BuilderSnapshot builder_snapshots = 2;
   386  }
   387  
   388  
   389  message QueryConsoleSnapshotsResponse {
   390    // A list of matched consoles.
   391    repeated ConsoleSnapshot snapshots = 1;
   392  
   393    // A token that can be sent as `page_token` to retrieve the next page.
   394    // If this field is omitted, there are no subsequent pages.
   395    string next_page_token = 2;
   396  }