go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/buildbucket/proto/project_config.proto (about) 1 // Copyright 2018 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 // Schemas for project configs. 16 17 syntax = "proto3"; 18 19 package buildbucket; 20 21 option go_package = "go.chromium.org/luci/buildbucket/proto;buildbucketpb"; 22 23 import "google/protobuf/duration.proto"; 24 import "google/protobuf/wrappers.proto"; 25 26 import "go.chromium.org/luci/buildbucket/proto/common.proto"; 27 import "go.chromium.org/luci/common/proto/options.proto"; 28 import "go.chromium.org/luci/resultdb/proto/v1/invocation.proto"; 29 30 option (luci.file_metadata) = { 31 doc_url: "https://config.luci.app/schemas/projects:buildbucket.cfg"; 32 }; 33 34 // Deprecated in favor of LUCI Realms. This proto is totally unused now, exists 35 // only to not break older configs that still may have deprecated fields 36 // populated. 37 message Acl { 38 enum Role { 39 READER = 0; 40 SCHEDULER = 1; 41 WRITER = 2; 42 } 43 Role role = 1 [deprecated = true]; 44 string group = 2 [deprecated = true]; 45 string identity = 3 [deprecated = true]; 46 } 47 48 // Defines a swarmbucket builder. A builder has a name, a category and specifies 49 // what should happen if a build is scheduled to that builder. 50 // 51 // SECURITY WARNING: if adding more fields to this message, keep in mind that 52 // a user that has permissions to schedule a build to the bucket, can override 53 // this config. 54 // 55 // Next tag: 40. 56 message BuilderConfig { 57 reserved 8; // cipd_packages 58 reserved 11; // build_numbers of the old format. 59 reserved 13; // auto_builder_dimension of the old format. 60 reserved 15; // experimental of the old format. 61 reserved 19; // luci_migration_host 62 reserved 27; // description of the old format. 63 64 // Describes a cache directory persisted on a bot. 65 // Prerequisite reading in BuildInfra.Swarming.CacheEntry message in 66 // build.proto. 67 // 68 // To share a builder cache among multiple builders, it can be overridden: 69 // 70 // builders { 71 // name: "a" 72 // caches { 73 // path: "builder" 74 // name: "my_shared_cache" 75 // } 76 // } 77 // builders { 78 // name: "b" 79 // caches { 80 // path: "builder" 81 // name: "my_shared_cache" 82 // } 83 // } 84 // 85 // Builders "a" and "b" share their builder cache. If an "a" build ran on a 86 // bot and left some files in the builder cache and then a "b" build runs on 87 // the same bot, the same files will be available in the builder cache. 88 message CacheEntry { 89 // Identifier of the cache. Length is limited to 128. 90 // Defaults to path. 91 // See also BuildInfra.Swarming.CacheEntry.name in build.proto. 92 string name = 1; 93 94 // Relative path where the cache in mapped into. Required. 95 // See also BuildInfra.Swarming.CacheEntry.path in build.proto. 96 string path = 2; 97 98 // Number of seconds to wait for a bot with a warm cache to pick up the 99 // task, before falling back to a bot with a cold (non-existent) cache. 100 // See also BuildInfra.Swarming.CacheEntry.wait_for_warm_cache in build.proto. 101 // The value must be multiples of 60 seconds. 102 int32 wait_for_warm_cache_secs = 3; 103 104 // Environment variable with this name will be set to the path to the cache 105 // directory. 106 string env_var = 4; 107 } 108 109 // DEPRECATED. See BuilderConfig.executable and BuilderConfig.properties 110 // 111 // To specify a recipe name, pass "$recipe_engine" property which is a JSON 112 // object having "recipe" property. 113 message Recipe { 114 // Deprecated "repository" mode used git to bootstrap recipes directly from 115 // the recipe repo. Use `cipd_package` ++ `cipd_version` below instead, as 116 // they are faster, more reliable, and more flexible (because they could be 117 // used to provide non-git, non-python recipes). 118 reserved 1; // repository 119 120 // Name of the recipe to run. 121 string name = 2; 122 123 // The CIPD package to fetch the recipes from. 124 // 125 // Typically the package will look like: 126 // 127 // infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build 128 // 129 // Recipes bundled from internal repositories are typically under 130 // `infra_internal/recipe_bundles/...`. 131 // 132 // But if you're building your own recipe bundles, they could be located 133 // elsewhere. 134 string cipd_package = 6; 135 136 // The CIPD version to fetch. This can be a lower-cased git ref (like 137 // `refs/heads/main` or `head`), or it can be a cipd tag (like 138 // `git_revision:dead...beef`). 139 // 140 // The default is `head`, which corresponds to the git repo's HEAD ref. This 141 // is typically (but not always) a symbolic ref for `refs/heads/master`. 142 string cipd_version = 5; 143 144 // Colon-separated build properties to set. 145 // Ignored if BuilderConfig.properties is set. 146 // 147 // Use this field for string properties and use properties_j for other 148 // types. 149 repeated string properties = 3; 150 151 // Same as properties, but the value must valid JSON. For example 152 // properties_j: "a:1" 153 // means property a is a number 1, not string "1". 154 // 155 // If null, it means no property must be defined. In particular, it removes 156 // a default value for the property, if any. 157 // 158 // Fields properties and properties_j can be used together, but cannot both 159 // specify values for same property. 160 repeated string properties_j = 4; 161 } 162 163 // ResultDB-specific information for a builder. 164 message ResultDB { 165 166 // Whether to enable ResultDB:Buildbucket integration. 167 bool enable = 1; 168 169 // Configuration for exporting test results to BigQuery. 170 // This can have multiple values to export results to multiple BigQuery 171 // tables, or to support multiple test result predicates. 172 repeated luci.resultdb.v1.BigQueryExport bq_exports = 2; 173 174 // Deprecated. Any values specified here are ignored. 175 luci.resultdb.v1.HistoryOptions history_options = 3; 176 } 177 178 // Buildbucket backend-specific information for a builder. 179 message Backend { 180 // URI for this backend, e.g. "swarming://chromium-swarm". 181 string target = 1; 182 183 // A string interpreted as JSON encapsulating configuration for this 184 // backend. 185 // TODO(crbug.com/1042991): Move priority, wait_for_capacity, etc. here. 186 string config_json = 2 [(luci.text_pb_format) = JSON]; 187 } 188 189 // Name of the builder. 190 // 191 // If a builder name, will be propagated to "builder" build tag and 192 // "buildername" recipe property. 193 // 194 // A builder name must be unique within the bucket, and match regex 195 // ^[a-zA-Z0-9\-_.\(\) ]{1,128}$. 196 string name = 1; 197 198 // Backend for this builder. 199 // If unset, builds are scheduled using the legacy pipeline. 200 Backend backend = 32; 201 202 // Alternate backend to use for this builder when the 203 // "luci.buildbucket.backend_alt" experiment is enabled. Works even when 204 // `backend` is empty. Useful for migrations to new backends. 205 Backend backend_alt = 33; 206 207 // Hostname of the swarming instance, e.g. "chromium-swarm.appspot.com". 208 // Required, but defaults to deprecated Swarming.hostname. 209 string swarming_host = 21; 210 211 reserved 10; // mixins 212 213 // Builder category. Will be used for visual grouping, for example in Code Review. 214 string category = 6; 215 216 // DEPRECATED. 217 // Used only to enable "vpython:native-python-wrapper" 218 // Does NOT actually propagate to swarming. 219 repeated string swarming_tags = 2; 220 221 // A requirement for a bot to execute the build. 222 // 223 // Supports 2 forms: 224 // - "<key>:<value>" - require a bot with this dimension. 225 // This is a shortcut for "0:<key>:<value>", see below. 226 // - "<expiration_secs>:<key>:<value>" - wait for up to expiration_secs. 227 // for a bot with the dimension. 228 // Supports multiple values for different keys and expiration_secs. 229 // expiration_secs must be a multiple of 60. 230 // 231 // If this builder is defined in a bucket, dimension "pool" is defaulted 232 // to the name of the bucket. See Bucket message below. 233 repeated string dimensions = 3; 234 235 // Specifies that a recipe to run. 236 // DEPRECATED: use exe. 237 Recipe recipe = 4; 238 239 // What to run when a build is ready to start. 240 buildbucket.v2.Executable exe = 23; 241 242 // A JSON object representing Build.input.properties. 243 // Individual object properties can be overridden with 244 // ScheduleBuildRequest.properties. 245 string properties = 24 [(luci.text_pb_format) = JSON]; 246 247 // A list of top-level property names which can be overridden in 248 // ScheduleBuildRequest. 249 // 250 // If this field is the EXACT value `["*"]` then all properties are permitted 251 // to be overridden. 252 // 253 // NOTE: Some executables (such as the recipe engine) can have drastic 254 // behavior differences based on some properties (for example, the "recipe" 255 // property). If you allow the "recipe" property to be overridden, then anyone 256 // with the 'buildbucket.builds.add' permission could create a Build for this 257 // Builder running a different recipe (from the same recipe repo). 258 repeated string allowed_property_overrides = 34; 259 260 // Swarming task priority. 261 // A value between 20 and 255, inclusive. 262 // Lower means more important. 263 // 264 // The default value is configured in 265 // https://chrome-internal.googlesource.com/infradata/config/+/master/configs/cr-buildbucket/swarming_task_template.json 266 // 267 // See also https://chromium.googlesource.com/infra/luci/luci-py.git/+/master/appengine/swarming/doc/User-Guide.md#request 268 uint32 priority = 5; 269 270 // Maximum build execution time. 271 // 272 // Not to be confused with pending time. 273 // 274 // If the timeout is reached, the task will be signaled according to the 275 // `deadline` section of 276 // https://chromium.googlesource.com/infra/luci/luci-py/+/HEAD/client/LUCI_CONTEXT.md 277 // and status_details.timeout is set. 278 // 279 // The task will have `grace_period` amount of time to handle cleanup 280 // before being forcefully terminated. 281 // 282 // NOTE: This corresponds with Build.execution_timeout and 283 // ScheduleBuildRequest.execution_timeout; The name `execution_timeout_secs` and 284 // uint32 type are relics of the past. 285 uint32 execution_timeout_secs = 7; 286 287 // Maximum amount of time to wait for the next heartbeat(i.e UpdateBuild). 288 // 289 // After a build is started, the client can send heartbeat requests 290 // periodically. Buildbucket will mark the build as INFRA_FAILURE, if the 291 // timeout threshold reaches. It’s to fail a build more quickly, rather than 292 // waiting for `execution_timeout_secs` to expire. Some V1 users, which don't 293 // have real task backends, can utilize this feature. 294 // 295 // By default, the value is 0, which means no timeout threshold is applied. 296 // 297 // Note: this field only takes effect for TaskBackendLite builds. For builds 298 // with full-featured TaskBackend Implementation, `sync_backend_tasks` cron 299 // job fulfills the similar functionality. 300 uint32 heartbeat_timeout_secs = 39; 301 302 // Maximum build pending time. 303 // 304 // If the timeout is reached, the build is marked as INFRA_FAILURE status 305 // and both status_details.{timeout, resource_exhaustion} are set. 306 // 307 // NOTE: This corresponds with Build.scheduling_timeout and 308 // ScheduleBuildRequest.scheduling_timeout; The name `expiration_secs` and 309 // uint32 type are relics of the past. 310 uint32 expiration_secs = 20; 311 312 // Amount of cleanup time after execution_timeout_secs. 313 // 314 // After being signaled according to execution_timeout_secs, the task will 315 // have this many seconds to clean up before being forcefully terminated. 316 // 317 // The signalling process is explained in the `deadline` section of 318 // https://chromium.googlesource.com/infra/luci/luci-py/+/HEAD/client/LUCI_CONTEXT.md. 319 // 320 // Defaults to 30s if unspecified or 0. 321 google.protobuf.Duration grace_period = 31; 322 323 // If YES, will request that swarming wait until it sees at least one bot 324 // report a superset of the requested dimensions. 325 // 326 // If UNSET/NO (the default), swarming will immediately reject a build which 327 // specifies a dimension set that it's never seen before. 328 // 329 // Usually you want this to be UNSET/NO, unless you know that some external 330 // system is working to add bots to swarming which will match the requested 331 // dimensions within expiration_secs. Otherwise you'll have to wait for all of 332 // `expiration_secs` until swarming tells you "Sorry, nothing has dimension 333 // `os:MadeUpOS`". 334 buildbucket.v2.Trinary wait_for_capacity = 29; 335 336 // Caches that should be present on the bot. 337 repeated CacheEntry caches = 9; 338 339 // If YES, generate monotonically increasing contiguous numbers for each 340 // build, unique within the builder. 341 // Note: this limits the build creation rate in this builder to 5 per second. 342 Toggle build_numbers = 16; 343 344 // Email of a service account to run the build as or literal 'bot' string to 345 // use Swarming bot's account (if available). Passed directly to Swarming. 346 // Subject to Swarming's ACLs. 347 string service_account = 12; 348 349 // If YES, each builder will get extra dimension "builder:<builder name>" 350 // added. Default is UNSET. 351 // 352 // For example, this config 353 // 354 // builder { 355 // name: "linux-compiler" 356 // dimension: "builder:linux-compiler" 357 // } 358 // 359 // is equivalent to this: 360 // 361 // builders { 362 // name: "linux-compiler" 363 // auto_builder_dimension: YES 364 // } 365 // 366 // (see also http://docs.buildbot.net/0.8.9/manual/cfg-properties.html#interpolate) 367 // but are currently against complicating config with this. 368 Toggle auto_builder_dimension = 17; 369 370 // DEPRECATED 371 // 372 // Set the "luci.non_production" experiment in the 'experiments' field below, 373 // instead. 374 // 375 // If YES, sets the "luci.non_production" experiment to 100% for 376 // builds on this builder. 377 // 378 // See the documentation on `experiments` for more details about the 379 // "luci.non_production" experiment. 380 Toggle experimental = 18; 381 382 // DEPRECATED 383 // 384 // Set the "luci.buildbucket.canary_software" experiment in the 'experiments' 385 // field below, instead. 386 // 387 // Percentage of builds that should use a canary swarming task template. 388 // A value from 0 to 100. 389 // If omitted, a global server-defined default percentage is used. 390 google.protobuf.UInt32Value task_template_canary_percentage = 22; 391 392 // A mapping of experiment name to the percentage chance (0-100) that it will 393 // apply to builds generated from this builder. Experiments are simply strings 394 // which various parts of the stack (from LUCI services down to your build 395 // scripts) may react to in order to enable certain functionality. 396 // 397 // You may set any experiments you like, but experiments beginning with 398 // "luci." are reserved. Experiment names must conform to 399 // 400 // [a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)* 401 // 402 // Any experiments which are selected for a build show up in 403 // `Build.input.experiments`. 404 // 405 // Its recommended that you confine your experiments to smaller, more explicit 406 // targets. For example, prefer the experiment named 407 // "my_project.use_mysoftware_v2_crbug_999999" rather than "use_next_gen". 408 // 409 // It is NOT recommended to 'piggy-back' on top of existing experiment names 410 // for a different purpose. However if you want to, you can have your build 411 // treat the presence of ANY experiment as equivalent to "luci.non_production" 412 // being set for your build (i.e. "if any experiment is set, don't affect 413 // production"). This is ulimately up to you, however. 414 // 415 // Well-known experiments 416 // 417 // Buildbucket has a number of 'global' experiments which are in various 418 // states of deployment at any given time. For the current state, see 419 // go/buildbucket-settings.cfg. 420 map<string, int32> experiments = 28; 421 422 // This field will set the default value of the "critical" field of 423 // all the builds of this builder. Please refer to build.proto for 424 // the meaning of this field. 425 // 426 // This value can be overridden by ScheduleBuildRequest.critical 427 buildbucket.v2.Trinary critical = 25; 428 429 // Used to enable and configure ResultDB integration. 430 ResultDB resultdb = 26; 431 432 // Description that helps users understand the purpose of the builder, in 433 // HTML. 434 string description_html = 30; 435 436 // Configurations that need to be replaced when running a led build for this 437 // Builder. 438 // 439 // Note: Builders in a dynamic bucket cannot have ShadowBuilderAdjustments. 440 message ShadowBuilderAdjustments { 441 string service_account = 1; 442 string pool = 2; 443 // A JSON object contains properties to override Build.input.properties 444 // when creating the led build. 445 // Same as ScheduleBuild, the top-level properties here will override the 446 // ones in builder config, instead of deep merge. 447 string properties = 3 [(luci.text_pb_format) = JSON]; 448 449 // Overrides default dimensions defined by builder config. 450 // Same as ScheduleBuild, 451 // * dimensions with empty value will be excluded. 452 // * same key dimensions with both empty and non-empty values are disallowed. 453 // 454 // Note: for historical reason, pool can be adjusted individually. 455 // If pool is adjusted individually, the same change should be reflected in 456 // dimensions, and vice versa. 457 repeated string dimensions = 4; 458 } 459 460 ShadowBuilderAdjustments shadow_builder_adjustments = 35; 461 462 // This field will set the default value of the "retriable" field of 463 // all the builds of this builder. Please refer to build.proto for 464 // the meaning of this field. 465 // 466 // This value can be overridden by ScheduleBuildRequest.retriable 467 buildbucket.v2.Trinary retriable = 36; 468 469 message BuilderHealthLinks { 470 // Mapping of username domain to clickable link for documentation on the health 471 // metrics and how they were calculated. 472 // 473 // The empty domain value will be used as a fallback for anonymous users, or 474 // if the user identity domain doesn't have a matching entry in this map. 475 // 476 // If linking an internal google link (say g3doc), use a go-link instead of a 477 // raw url. 478 map<string, string> doc_links = 1; 479 // Mapping of username domain to clickable link for data visualization or 480 // dashboards for the health metrics. 481 // 482 // Similar to doc_links, the empty domain value will be used as a fallback for 483 // anonymous users, or if the user identity domain doesn't have a matching 484 // entry in this map. 485 // 486 // If linking an internal google link (say g3doc), use a go-link instead of a 487 // raw url. 488 map<string, string> data_links = 2; 489 } 490 491 BuilderHealthLinks builder_health_metrics_links = 37; 492 493 // The owning team's contact email. This team is responsible for fixing 494 // any builder health issues (see Builder.Metadata.HealthSpec). 495 // Will be validated as an email address, but nothing else. 496 // It will display on milo and could be public facing, so please don't put anything sensitive. 497 string contact_team_email = 38; 498 } 499 500 // Configuration of buildbucket-swarming integration for one bucket. 501 message Swarming { 502 reserved 1; // hostname 503 reserved 2; // url_format 504 reserved 3; // builder_defaults 505 506 // Configuration for each builder. 507 // Swarming tasks are created only for builds for builders that are not 508 // explicitly specified. 509 repeated BuilderConfig builders = 4; 510 511 // DEPRECATED. Use builder_defaults.task_template_canary_percentage instead. 512 // Setting this field sets builder_defaults.task_template_canary_percentage. 513 google.protobuf.UInt32Value task_template_canary_percentage = 5; 514 } 515 516 // Defines one bucket in buildbucket.cfg 517 message Bucket { 518 reserved 4; // acl_sets 519 520 // Name of the bucket. Names are unique within one instance of buildbucket. 521 // If another project already uses this name, a config will be rejected. 522 // Name reservation is first-come first-serve. 523 // Regex: ^[a-z0-9\-_.]{1,100}$ 524 string name = 1; 525 // Deprecated and ignored. Use Realms ACLs instead. 526 repeated Acl acls = 2 [deprecated = true]; 527 // Buildbucket-swarming integration. 528 // Mutually exclusive with builder_template. 529 Swarming swarming = 3; 530 531 // Name of this bucket's shadow bucket for the led builds to use. 532 // 533 // If omitted, it implies that led builds of this bucket reuse this bucket. 534 // This is allowed, but note that it means the led builds will be in 535 // the same bucket/builder with the real builds, which means Any users with 536 // led access will be able to do ANYTHING that this bucket's bots and 537 // service_accounts can do. 538 // 539 // It could also be noisy, such as: 540 // * On the LUCI UI, led builds will show under the same builder as the real builds, 541 // * Led builds will share the same ResultDB config as the real builds, so 542 // their test results will be exported to the same BigQuery tables. 543 // * Subscribers of Buildbucket PubSub need to filter them out. 544 // 545 // Note: Don't set it if it's a dynamic bucket. Currently, a dynamic bucket is 546 // not allowed to have a shadow bucket. 547 string shadow = 5; 548 549 // Constraints for a bucket. 550 // 551 // Buildbucket.CreateBuild will validate the incoming requests to make sure 552 // they meet these constraints. 553 message Constraints { 554 // Constraints allowed pools. 555 // Builds in this bucket must have a "pool" dimension which matches an entry in this list. 556 repeated string pools = 1; 557 558 // Only service accounts in this list are allowed. 559 repeated string service_accounts = 2; 560 } 561 562 // Security constraints of the bucket. 563 // 564 // This field is used by CreateBuild on this bucket to constrain proposed 565 // Builds. If a build doesn't meet the constraints, it will be rejected. 566 // For shadow buckets, this is what prevents the bucket from allowing 567 // totally arbitrary Builds. 568 // 569 // `lucicfg` will automatically populate this for the "primary" bucket 570 // when using `luci.builder`. 571 // 572 // Buildbuceket.CreateBuild will validate the incoming requests to make sure 573 // they meet these constraints. 574 Constraints constraints = 6; 575 576 // Template of builders in a dynamic bucket. 577 message DynamicBuilderTemplate { 578 // The Builder template which is shared among all builders in this dynamic 579 // bucket. 580 BuilderConfig template = 1; 581 } 582 583 // Template of builders in a dynamic bucket. 584 // Mutually exclusive with swarming. 585 // 586 // If is not nil, the bucket is a dynamic LUCI bucket. 587 // If a bucket has both swarming and dynamic_builder_template as nil, 588 // the bucket is a legacy one. 589 DynamicBuilderTemplate dynamic_builder_template = 7; 590 } 591 592 // Schema of buildbucket.cfg file, a project config. 593 message BuildbucketCfg { 594 reserved 2; // acl_sets 595 reserved 3; // builder_mixins 596 reserved 4; // might be taken by builds_notification_topics 597 598 // All buckets defined for this project. 599 repeated Bucket buckets = 1; 600 601 message Topic { 602 // Topic name format should be like 603 // "projects/<projid>/topics/<topicid>" and conforms to the guideline: 604 // https://cloud.google.com/pubsub/docs/admin#resource_names. 605 string name = 1; 606 607 // The compression method that `build_large_fields` uses in pubsub message 608 // data. By default, it's ZLIB as this is the most common one and is the 609 // built-in lib in many programming languages. 610 buildbucket.v2.Compression compression = 2; 611 } 612 613 message CommonConfig { 614 // A list of PubSub topics that Buildbucket will publish notifications for 615 // build status changes in this project. 616 // The message data schema can be found in message `BuildsV2PubSub` in 617 // https://chromium.googlesource.com/infra/luci/luci-go/+/main/buildbucket/proto/notification.proto 618 // Attributes on the pubsub messages: 619 // - "project" 620 // - "bucket" 621 // - "builder" 622 // - "is_completed" (The value is either "true" or "false" in string.) 623 // 624 // Note: `pubsub.topics.publish` permission must be granted to the 625 // corresponding luci-project-scoped accounts in the cloud project(s) hosting 626 // the topics. 627 repeated Topic builds_notification_topics = 1; 628 } 629 630 // Global configs are shared among all buckets and builders defined inside 631 // this project. 632 CommonConfig common_config = 5; 633 } 634 635 // Toggle is a boolean with an extra state UNSET. 636 // When protobuf messages are merged, UNSET does not overwrite an existing 637 // value. 638 // TODO(nodir): replace with Trinary in ../common.proto. 639 enum Toggle { 640 UNSET = 0; 641 YES = 1; 642 NO = 2; 643 }