go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/config_service/proto/config_service.proto (about) 1 // Copyright 2023 The LUCI Authors. All rights reserved. 2 // Use of this source code is governed under the Apache License, Version 2.0 3 // that can be found in the LICENSE file. 4 5 syntax = "proto3"; 6 7 package config.service.v2; 8 9 option go_package = "go.chromium.org/luci/config_service/proto;configpb"; 10 11 // Allow to generate *_pb2.py files. 12 option py_generic_services = true; 13 14 import "google/protobuf/field_mask.proto"; 15 import "google/protobuf/timestamp.proto"; 16 17 import "go.chromium.org/luci/common/proto/config/service_config.proto"; 18 19 20 // Configs Service. 21 service Configs { 22 // Get one configuration. 23 rpc GetConfig(GetConfigRequest) returns (Config) {}; 24 25 // Get the specified project configs from all projects. 26 rpc GetProjectConfigs(GetProjectConfigsRequest) returns (GetProjectConfigsResponse) {}; 27 28 // List config sets. 29 rpc ListConfigSets(ListConfigSetsRequest) returns (ListConfigSetsResponse) {}; 30 31 // Get a single config set. 32 rpc GetConfigSet(GetConfigSetRequest) returns (ConfigSet) {}; 33 34 // Validates configs for a config set. 35 // 36 // The validation workflow works as follows (assuming first time validation): 37 // 1. Client sends the manifest of the config directory for validation. The 38 // manifest consists of the relative posix style path to each config file 39 // and the SHA256 hash of the content of each config file. 40 // 2. Server returns grpc error status with InvalidArgument code and 41 // a `BadValidationRequestFixInfo` message in status_detail. 42 // `BadValidationRequestFixInfo` should contain a signed url for each 43 // config file and Client is responsible to upload the *gzip compressed* 44 // config to the url. Client should also fix any remaining error mentioned 45 // in `BadValidationRequestFixInfo`. Note that, if the request contains 46 // any invalid argument like malformed config set or absolute file path, 47 // LUCI Config will only return the grpc error status with InvalidArgument 48 // code but without anything in status_details because those type of errors 49 // are not fixable. 50 // 3. Call the server again with the same validation request as in step 1. The 51 // Server should be able to perform the validation and return the 52 // result. 53 // 4. Repeat step 1-3 for any subsequent validation request. Note that for 54 // step 2, the Server would only ask client to upload files that it has 55 // not seen their hashes in any previous validation session (for up to 1 56 // day). 57 rpc ValidateConfigs(ValidateConfigsRequest) returns (config.ValidationResult) {}; 58 } 59 60 // A request message for GetConfig rpc. 61 message GetConfigRequest { 62 // ConfigSet where the requested config belongs to. 63 // 64 // Required. 65 string config_set = 1; 66 67 // Path of the config. Mutually exclusive with content_sha256. 68 string path = 2; 69 70 // Content SHA256 value of the config. Mutually exclusive with path. 71 string content_sha256 = 3; 72 73 // Fields of the Config proto to include. 74 // 75 // By default, all fields are included. 76 // 77 // Note: For content field, the client should always pass "content" to get 78 // the content. Populating "raw_content" or "signed_url" is a pure server 79 // side decision based on the size of the config. Therefore, explicitly 80 // passing one of "raw_content" or "signed_url" may cause unexpected 81 // behavior. For example, "raw_content" is passed and the content is large 82 // and supposed to return by signed_url field, the client would get an 83 // empty "raw_content". 84 google.protobuf.FieldMask fields = 4; 85 } 86 87 // A single config. 88 message Config { 89 // Name of the config set. 90 // For a service config set, "services/<service_id>". 91 // For a project config set, "projects/<project_id>". 92 string config_set = 1; 93 94 // Path of the config file relative to the config directory. 95 string path = 2; 96 97 // Content of the config. 98 oneof content { 99 // For small content where its raw content is less than 30MB and gzipped 100 // size is less than 800KB, the raw and uncompressed content will be 101 // included directly. 102 bytes raw_content = 3; 103 104 // For large content, a sign_url which points the actual config content 105 // will be provided. 106 // Note: The signed url is set to expire in 10 minutes. And it's encouraged 107 // to use "Accept-Encoding: gzip" header in the request to minimize the size 108 // in data transfer, and decompress it by yourself. 109 string signed_url = 4; 110 } 111 112 // SHA256 value of the raw content. 113 string content_sha256 = 5; 114 115 // Size of the raw config in bytes. 116 int64 size = 8; 117 118 // Git revision 119 string revision = 6; 120 121 // Original config file url on Git repo. 122 string url = 7; 123 } 124 125 // Get project-level configs matched with the provided path in all `projects/xxx` 126 // config_sets. 127 message GetProjectConfigsRequest { 128 // Required 129 // Path to the desired config in each project config set. 130 // 131 // TODO: In future, it can expand to support regex match in some ways, since 132 // in v2, Luci-config is supposed to support multi-file configuration. 133 // For example, `cr-buildbucket.cfg` can be split into smaller configs, 134 // e.g. `bucket-a.cfg`, `bucket-b.cfg`, etc. But file names might be dynamic 135 // and how these files are organized with other project configs are undecided. 136 // It's better to implement the regex check logic when there is a concrete 137 // use case. 138 string path = 1; 139 140 // Fields of Config proto to include. 141 // 142 // By default, all fields are included. 143 google.protobuf.FieldMask fields = 2; 144 } 145 146 // GetProjectConfigsResponse is the response of GetProjectConfigs rpc. 147 // 148 // Note: When the sum of the first ith config.Content size larger than 200MB, 149 // the rest of config.Content will be always a signed url. 150 message GetProjectConfigsResponse { 151 // The requested configs in each project. 152 repeated Config configs = 1; 153 } 154 155 // ValidateConfigsRequest is the request of ValidateConfigs rpc. 156 message ValidateConfigsRequest { 157 message FileHash { 158 // Relative path to the config file in POSIX style. 159 string path = 1; 160 // The SHA256 hash of the config file. 161 string sha256 = 2; 162 } 163 // ConfigSet to validate against. 164 // 165 // See: https://pkg.go.dev/go.chromium.org/luci/config#Set 166 string config_set = 1; 167 // FileHashes represent the manifest of the config directory. 168 repeated FileHash file_hashes = 2; 169 } 170 171 // BadValidationRequestFixInfo describes the problem in `ValidateConfigsRequest` 172 // and provide the fix instruction. The server will include this message in 173 // grpc error status details[1] and return InvalidArgument error code. 174 // 175 // [1]: https://github.com/googleapis/googleapis/blob/f36c65081b19e0758ef5696feca27c7dcee5475e/google/rpc/status.proto#L48 176 message BadValidationRequestFixInfo { 177 message UploadFile { 178 // Relative path to the config file in POSIX style. 179 string path = 1; 180 // The url to upload the config. 181 // 182 // The caller SHOULD send compressed config and include following headers 183 // * Content-Encoding: gzip 184 // * x-goog-content-length-range: 0,$max_config_size 185 string signed_url = 2; 186 // Maximum config size in bytes that client can upload. 187 int64 max_config_size = 3; 188 } 189 // The files that have NOT been seen by LUCI Config and need to be uploaded. 190 repeated UploadFile upload_files = 1; 191 // Files that none of the services can validate and SHOULD NOT be included 192 // in the ValidateConfigsRequest. 193 repeated string unvalidatable_files = 2; 194 } 195 196 // ListConfigSetsRequest is the request of ListConfigSets rpc. 197 message ListConfigSetsRequest { 198 enum ConfigSetDomain { 199 // The default value when domain is omitted. Used to retrieve config sets 200 // in all domains. 201 ALL = 0; 202 // Service domain. 203 SERVICE = 1; 204 // Project domain. 205 PROJECT = 2; 206 } 207 208 // List config sets in the specified domain. 209 ConfigSetDomain domain = 1; 210 211 // Fields of ConfigSet proto to include. 212 // By default, only return config_set, url and revision fields. 213 // Note: "file_paths" and "configs" is not supported in this rpc and only be 214 // supported in GetConfigSet rpc. 215 google.protobuf.FieldMask fields = 2; 216 } 217 218 // ListConfigSetsResponse is the response of ListConfigSets rpc. 219 message ListConfigSetsResponse { 220 // A list of config sets. 221 repeated ConfigSet config_sets = 1; 222 } 223 224 // A single ConfigSet. 225 message ConfigSet { 226 message Revision { 227 // Revision id. 228 string id = 1; 229 // Repo url points to this revision of config set. 230 string url = 2; 231 // Committer email who commit this revision 232 string committer_email = 3; 233 // The commit author email. 234 string author_email = 5; 235 // Time of this committed revision. 236 google.protobuf.Timestamp timestamp = 4; 237 } 238 239 // Attempt information about importing this config set. 240 message Attempt { 241 // Human-readable message of the attempt. 242 string message = 1; 243 // Whether this attempt is successful or not. 244 bool success = 2; 245 // Git revision attempt to import 246 Revision revision = 3; 247 // Time of this attempt. 248 google.protobuf.Timestamp timestamp = 4; 249 // The validation result in this import attempt. 250 config.ValidationResult validationResult = 5; 251 } 252 253 // Name of the config set. 254 string name = 1; 255 256 // Git Repo url which holds configs of this config set. 257 string url = 2; 258 259 // Latest imported Git revision. 260 Revision revision = 3; 261 262 // All file paths related to the corresponding config set location. 263 // 264 // Use `configs` instead. 265 repeated string file_paths = 4 [deprecated = true]; 266 267 // Last import attempt information. 268 Attempt last_import_attempt = 5; 269 270 // Metadata of all config files in the set. 271 // 272 // Messages here exclude `raw_content` and `signed_url`. Use separate 273 // GetConfig call to fetch the full config file body. 274 repeated Config configs = 6; 275 } 276 277 // GetConfigSetRequest is the request of GetConfigSet rpc. 278 message GetConfigSetRequest { 279 // Config set to fetch. 280 string config_set = 1; 281 282 // Fields of ConfigSet proto to include. 283 // By default, only return config_set, url and revision fields. 284 google.protobuf.FieldMask fields = 2; 285 }