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