build_service.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. // Copyright 2021 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. syntax = "proto3";
  15. package google.chromeos.moblab.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/chromeos/moblab/v1beta1/resources.proto";
  21. import "google/longrunning/operations.proto";
  22. import "google/protobuf/field_mask.proto";
  23. import "google/protobuf/timestamp.proto";
  24. option go_package = "google.golang.org/genproto/googleapis/chromeos/moblab/v1beta1;moblab";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "BuildServiceProto";
  27. option java_package = "com.google.chromeos.moblab.v1beta1";
  28. option optimize_for = SPEED;
  29. // Manages Chrome OS build services.
  30. service BuildService {
  31. option (google.api.default_host) = "chromeosmoblab.googleapis.com";
  32. option (google.api.oauth_scopes) =
  33. "https://www.googleapis.com/auth/moblabapi";
  34. // Lists all build targets that a user has access to.
  35. rpc ListBuildTargets(ListBuildTargetsRequest) returns (ListBuildTargetsResponse) {
  36. option (google.api.http) = {
  37. get: "/v1beta1/buildTargets"
  38. };
  39. }
  40. // Lists all models for the given build target.
  41. rpc ListModels(ListModelsRequest) returns (ListModelsResponse) {
  42. option (google.api.http) = {
  43. get: "/v1beta1/{parent=buildTargets/*}/models"
  44. };
  45. option (google.api.method_signature) = "parent";
  46. }
  47. // Lists all builds for the given build target and model in descending order
  48. // for the milestones and build versions.
  49. rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) {
  50. option (google.api.http) = {
  51. get: "/v1beta1/{parent=buildTargets/*/models/*}/builds"
  52. };
  53. option (google.api.method_signature) = "parent";
  54. }
  55. // Checks the stage status for a given build artifact in a partner Google
  56. // Cloud Storage bucket.
  57. rpc CheckBuildStageStatus(CheckBuildStageStatusRequest) returns (CheckBuildStageStatusResponse) {
  58. option (google.api.http) = {
  59. get: "/v1beta1/{name=buildTargets/*/models/*/builds/*/artifacts/*}:check"
  60. };
  61. option (google.api.method_signature) = "name";
  62. }
  63. // Stages a given build artifact from a internal Google Cloud Storage bucket
  64. // to a partner Google Cloud Storage bucket. If any of objects has already
  65. // been copied, it will overwrite the previous objects. Operation <response:
  66. // [StageBuildResponse][google.chromeos.moblab.v1beta1.StageBuildResponse],
  67. // metadata: [StageBuildMetadata][google.chromeos.moblab.v1beta1.StageBuildMetadata]>
  68. rpc StageBuild(StageBuildRequest) returns (google.longrunning.Operation) {
  69. option (google.api.http) = {
  70. post: "/v1beta1/{name=buildTargets/*/models/*/builds/*/artifacts/*}:stage"
  71. body: "*"
  72. };
  73. option (google.api.method_signature) = "name";
  74. option (google.longrunning.operation_info) = {
  75. response_type: "StageBuildResponse"
  76. metadata_type: "StageBuildMetadata"
  77. };
  78. }
  79. // Finds the most stable build for the given build target. The definition of
  80. // the most stable build is determined by evaluating the following rules in
  81. // order until one is true. If none are true, then there is no stable build
  82. // and it will return an empty response.
  83. //
  84. // Evaluation rules:
  85. // 1. Stable channel build with label “Live”
  86. // 2. Beta channel build with label “Live”
  87. // 3. Dev channel build with label “Live”
  88. // 4. Most recent stable channel build with build status Pass
  89. // 5. Most recent beta channel build with build status Pass
  90. // 6. Most recent dev channel build with build status Pass
  91. rpc FindMostStableBuild(FindMostStableBuildRequest) returns (FindMostStableBuildResponse) {
  92. option (google.api.http) = {
  93. get: "/v1beta1/{build_target=buildTargets/*}:findMostStableBuild"
  94. };
  95. option (google.api.method_signature) = "build_target";
  96. }
  97. }
  98. // Request message for finding the most stable build.
  99. message FindMostStableBuildRequest {
  100. // Required. The full resource name of the build target.
  101. // For example,
  102. // 'buildTargets/octopus'.
  103. string build_target = 1 [
  104. (google.api.field_behavior) = REQUIRED,
  105. (google.api.resource_reference) = {
  106. type: "chromeosmoblab.googleapis.com/BuildTarget"
  107. }
  108. ];
  109. }
  110. // Response message for finding the most stable build.
  111. message FindMostStableBuildResponse {
  112. // The most stable build.
  113. Build build = 1;
  114. }
  115. // Request message for listing build targets.
  116. message ListBuildTargetsRequest {
  117. // Optional. The number of build targets to return in a page.
  118. int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
  119. // Optional. A page token, received from a previous `ListBuildTargets` call. Provide
  120. // this to retrieve the subsequent page.
  121. string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
  122. }
  123. // Response message for listing build targets.
  124. message ListBuildTargetsResponse {
  125. // The list of build targets.
  126. repeated BuildTarget build_targets = 1;
  127. // Token to retrieve the next page of build targets. If this field is omitted,
  128. // there are no subsequent pages.
  129. string next_page_token = 2;
  130. // Total number of build targets.
  131. int32 total_size = 3;
  132. }
  133. // Request message for listing models.
  134. message ListModelsRequest {
  135. // Required. The full resource name of build target.
  136. string parent = 1 [
  137. (google.api.field_behavior) = REQUIRED,
  138. (google.api.resource_reference) = {
  139. type: "chromeosmoblab.googleapis.com/BuildTarget"
  140. }
  141. ];
  142. // Optional. The number of models to return in a page.
  143. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  144. // Optional. A page token, received from a previous `ListModels` call. Provide
  145. // this to retrieve the subsequent page.
  146. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  147. }
  148. // Response message for listing models.
  149. message ListModelsResponse {
  150. // The list of models.
  151. repeated Model models = 1;
  152. // Token to retrieve the next page of models. If this field is omitted, there
  153. // are no subsequent pages.
  154. string next_page_token = 2;
  155. // Total number of models.
  156. int32 total_size = 3;
  157. }
  158. // Request message for listing builds.
  159. message ListBuildsRequest {
  160. // Required. The full resource name of the model. The model id is the same as
  161. // the build target id for non-unified builds.
  162. // For example,
  163. // 'buildTargets/octopus/models/bobba'.
  164. string parent = 1 [
  165. (google.api.field_behavior) = REQUIRED,
  166. (google.api.resource_reference) = {
  167. type: "chromeosmoblab.googleapis.com/Model"
  168. }
  169. ];
  170. // Optional. The number of builds to return in a page.
  171. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  172. // Optional. A page token, received from a previous `ListBuilds` call. Provide this to
  173. // retrieve the subsequent page.
  174. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  175. // Optional. Filter that specifies value constraints of fields. For example, the
  176. // filter can be set as "filter='milestone=milestones/80'" to only select
  177. // builds in milestone 80.
  178. string filter = 4 [(google.api.field_behavior) = OPTIONAL];
  179. // Optional. Read mask that specifies which Build fields to return. If empty, all Build
  180. // fields will be returned.
  181. // Valid fields: name, milestone, build_version.
  182. // For example, if the read_mask is set as "read_mask='milestone'", the
  183. // ListBuilds will return a list of Builds object with only the milestone
  184. // field.
  185. google.protobuf.FieldMask read_mask = 5 [(google.api.field_behavior) = OPTIONAL];
  186. // Optional. The operation that groups by all the Build fields specified in the read
  187. // mask. The group_by field should be the same as the read_mask field in
  188. // convention of SQL.
  189. google.protobuf.FieldMask group_by = 6 [(google.api.field_behavior) = OPTIONAL];
  190. }
  191. // Response message for listing builds.
  192. message ListBuildsResponse {
  193. // The list of builds.
  194. repeated Build builds = 1;
  195. // Token to retrieve the next page of builds. If this field is omitted, there
  196. // are no subsequent pages.
  197. string next_page_token = 2;
  198. // Total number of builds.
  199. int32 total_size = 3;
  200. }
  201. // Request message for checking if the build artifact is staged.
  202. message CheckBuildStageStatusRequest {
  203. // Required. The full resource name of the build artifact.
  204. // For example,
  205. // 'buildTargets/octopus/models/bobba/builds/12607.6.0/artifacts/chromeos-moblab-peng-staging'.
  206. string name = 1 [
  207. (google.api.field_behavior) = REQUIRED,
  208. (google.api.resource_reference) = {
  209. type: "chromeosmoblab.googleapis.com/BuildArtifact"
  210. }
  211. ];
  212. // Optional. Filter that specifies value constraints of fields. For example, the
  213. // filter can be set as "filter='type=release'" to only check the release
  214. // builds.
  215. string filter = 2 [(google.api.field_behavior) = OPTIONAL];
  216. }
  217. // Response message for checking the stage status of a build artifact.
  218. message CheckBuildStageStatusResponse {
  219. // The status to represent if the build is staged or not.
  220. bool is_build_staged = 1;
  221. // The staged build artifact in the destination bucket.
  222. BuildArtifact staged_build_artifact = 2;
  223. // The source build artifact in the source bucket.
  224. BuildArtifact source_build_artifact = 3;
  225. }
  226. // Request message for staging a build artifact.
  227. message StageBuildRequest {
  228. // Required. The full resource name of the build artifact.
  229. // For example,
  230. // 'buildTargets/octopus/models/bobba/builds/12607.6.0/artifacts/chromeos-moblab-peng-staging'.
  231. string name = 1 [
  232. (google.api.field_behavior) = REQUIRED,
  233. (google.api.resource_reference) = {
  234. type: "chromeosmoblab.googleapis.com/BuildArtifact"
  235. }
  236. ];
  237. // Optional. Filter that specifies value constraints of fields. For example, the
  238. // filter can be set as "filter='type=release'" to only check the release
  239. // builds.
  240. string filter = 2 [(google.api.field_behavior) = OPTIONAL];
  241. }
  242. // Response message for staging a build artifact.
  243. message StageBuildResponse {
  244. // The staged build in the destination bucket.
  245. BuildArtifact staged_build_artifact = 1;
  246. }
  247. // Metadata message for staging a build artifact.
  248. message StageBuildMetadata {
  249. // Approximate percentage of progress, e.g. "50" means 50%.
  250. float progress_percent = 1;
  251. // Build stage start time.
  252. google.protobuf.Timestamp start_time = 2;
  253. // Build stage end time.
  254. google.protobuf.Timestamp end_time = 3;
  255. }