build_service.proto 9.5 KB

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