go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/buildbucket/proto/service_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 service configs.
    16  
    17  syntax = "proto3";
    18  
    19  package buildbucket;
    20  
    21  import "google/protobuf/duration.proto";
    22  import "go.chromium.org/luci/buildbucket/proto/project_config.proto";
    23  
    24  option go_package = "go.chromium.org/luci/buildbucket/proto;buildbucketpb";
    25  
    26  // Schema of settings.cfg file, a service config.
    27  message SettingsCfg {
    28    // Swarmbucket settings.
    29    SwarmingSettings swarming = 1;
    30    LogDogSettings logdog = 2;
    31    ResultDBSettings resultdb = 4;
    32  
    33    ExperimentSettings experiment = 5;
    34  
    35    CipdSettings cipd = 6;
    36  
    37    // List of Gerrit hosts to force git authentication for.
    38    //
    39    // By default public hosts are accessed anonymously, and the anonymous access
    40    // has very low quota. Context needs to know all such hostnames in advance to
    41    // be able to force authenticated access to them.
    42    repeated string known_public_gerrit_hosts = 3;
    43  
    44    // List of known backend configurations.
    45    repeated BackendSetting backends = 7;
    46  
    47    // A swarming_host -> backend_target map.
    48    // It's used during the raw swarming to swarming based backend migration to
    49    // derive a backend config from swarming related configs.
    50    // So we could control the migration process behind the scene.
    51    map<string, string> swarming_backends = 8;
    52  }
    53  
    54  // Backend setting.
    55  message BackendSetting {
    56    // Target backend. e.g. "swarming://chromium-swarm".
    57    string target = 1;
    58  
    59    // hostname for the target backend. e.g. chromium-swarm.appspot.com
    60    string hostname = 2;
    61  
    62    // The associated UpdateBuildTask pubsub id for this task backend.
    63    // This must be set in order for buildbucket to recieve task updates and send
    64    // a pubsup topic that the task backend can use to send updates to.
    65    // This id is provided by the backend owner, but added to buildbucket's service
    66    // config by the buildbucket team.
    67    // Buildbucket will subscribe to the pubsub subscription, which itself is
    68    // subscribed to the topic that task backends send messages to.
    69    // i.e.
    70    //     For this pubsub subscription:
    71    //         project/cr-buildbucket/subscriptions/chormium-swarm-backend
    72    //     and topic:
    73    //         project/cr-buildbucket/topics/chormium-swarm-backend
    74    //     The pubsub_id would be:
    75    //         chormium-swarm-backend
    76    //
    77    // DEPRECATED: please set into `full_mode` field.
    78    string pubsub_id = 3 [deprecated = true];
    79  
    80    // Setting for the fetch tasks cron job.
    81    message BuildSyncSetting {
    82      // Number of shards for Buildbucket to save the update_time of the builds on
    83      // this backend.
    84      //
    85      // In Build model, we need to keep an index on the build update time in order
    86      // to get all builds it haven't heard for a while.
    87      // To avoid hotspotting, a new computed property NextBackendSyncTime is added
    88      // for indexing, with format
    89      // <backend_target>--<project>--<shard index>--<update_time>.
    90      //
    91      // Because some backends serves significantly larger amount of builds than
    92      // other backends, we need different number of shards for each backend.
    93      //
    94      // Must be greater than or equal to 0, while 0 effectively means 1 shard.
    95      //
    96      // Note: when updating this field, the new number MUST be greater than the
    97      // old one.
    98      int32 shards = 1;
    99  
   100      // How often should a incomplete build get updated. If Buildbucket doesn't
   101      // hear from this build for sync_interval, it will sync it with its backend
   102      // task.
   103      //
   104      // Buildbucket runs a cron job to find builds to sync every minute, so
   105      // sync_interval_seconds must be greater than or equal to 60.
   106      //
   107      // If unset, a default threshold of 5min will be applied.
   108      int32 sync_interval_seconds = 2;
   109  
   110      // In the future, we could also add backoff factor here when have a use case.
   111    }
   112  
   113    // DEPRECATED: please set into `full_mode` field.
   114    BuildSyncSetting build_sync_setting = 4 [deprecated = true];
   115  
   116    // The corresponding backend should be a full-featured `TaskBackend`
   117    // implementation.
   118    message FullMode {
   119      // The associated UpdateBuildTask pubsub id for this task backend.
   120      // This must be set in order for buildbucket to recieve task updates and send
   121      // a pubsup topic that the task backend can use to send updates to.
   122      // This id is provided by the backend owner, but added to buildbucket's service
   123      // config by the buildbucket team.
   124      // Buildbucket will subscribe to the pubsub subscription, which itself is
   125      // subscribed to the topic that task backends send messages to.
   126      // i.e.
   127      //     For this pubsub subscription:
   128      //         project/cr-buildbucket/subscriptions/chormium-swarm-backend
   129      //     and topic:
   130      //         project/cr-buildbucket/topics/chormium-swarm-backend
   131      //     The pubsub_id would be:
   132      //         chormium-swarm-backend
   133      string pubsub_id = 1;
   134  
   135      // The setting for syncing backend tasks.
   136      BuildSyncSetting build_sync_setting = 2;
   137  
   138      // If set to true, visiting "cr-buildbucket.appspot.com/build/<build_id>"
   139      // will be redirected to the corresponding task page instead of the Milo
   140      // build page.
   141      bool redirect_to_task_page = 3;
   142    }
   143  
   144    // The corresponding backend should be a `TaskBackendLite` implementation,
   145    // where it doesn't support the task update and sync.
   146    message LiteMode {
   147    }
   148  
   149    // The mode of the backend.
   150    oneof Mode {
   151      FullMode full_mode = 5;
   152      LiteMode lite_mode = 6;
   153    }
   154  
   155    // Maximum time for Buildbucket to retry creating a task.
   156    //
   157    // Default timeout is 10 minutes.
   158    //
   159    // If the timeout is reached, the build is marked as INFRA_FAILURE status.
   160    google.protobuf.Duration task_creating_timeout = 7;
   161  }
   162  
   163  // Swarmbucket settings.
   164  message SwarmingSettings {
   165    reserved 1; // default_hostname
   166    // Swarmbucket build URLs will point to this Milo instance.
   167    string milo_hostname = 2;
   168  
   169    // These caches are available to all builders implicitly.
   170    // A builder may override a cache specified here.
   171    repeated BuilderConfig.CacheEntry global_caches = 4;
   172  
   173    // CIPD package. Does not specify installation path.
   174    message Package {
   175      // CIPD package name, e.g. "infra/python/cpython/${platform}"
   176      string package_name = 1;
   177      // CIPD instance version, e.g. "version:2.7.15.chromium14".
   178      // Used for non-canary builds.
   179      string version = 2;
   180      // CIPD instance version for canary builds.
   181      // Defaults to version.
   182      string version_canary = 3;
   183  
   184      // Include in builders matching the predicate.
   185      BuilderPredicate builders = 4;
   186  
   187      // Subdirectory to install the package into, relative to the installation
   188      // root. Useful if installing two packages at the same root would conflict.
   189      string subdir = 5;
   190  
   191      // Omit this package from the build having any of these experiments.
   192      repeated string omit_on_experiment = 6;
   193  
   194      // If non-empty, include this package only on builds which have any of these
   195      // experiments set. `omit_on_experiment` takes precedence if an experiment
   196      // is in both of these lists.
   197      repeated string include_on_experiment = 7;
   198    }
   199  
   200    // Packages available to the user executable in $PATH.
   201    // Installed in "{TASK_RUN_DIR}/cipd_bin_packages".
   202    // "{TASK_RUN_DIR}/cipd_bin_packages" and
   203    // "{TASK_RUN_DIR}/cipd_bin_packages/bin" are prepended to $PATH.
   204    repeated Package user_packages = 5;
   205  
   206    reserved 6; // luci_runner_package
   207  
   208    // Package of buildbucket agent,
   209    // https://chromium.googlesource.com/infra/luci/luci-go/+/HEAD/buildbucket/cmd/bbagent
   210    // used to run LUCI executables.
   211    Package bbagent_package = 8;
   212  
   213    // CIPD package of kitchen binary. DEPRECATED. TODO(nodir): remove.
   214    Package kitchen_package = 7;
   215  
   216    // Package of alternative buildbucket agent sources.
   217    // They should only be used in certain situations (i.e. in an experiment),
   218    // so they should have constraints on either omit_on_experiment
   219    // or include_on_experiment.
   220    repeated Package alternative_agent_packages = 9;
   221  
   222    // Packages for bbagent to use.
   223    // Installed in "{TASK_RUN_DIR}/bbagent_utility_packages".
   224    repeated Package bbagent_utility_packages = 10;
   225  }
   226  
   227  message LogDogSettings {
   228    // Hostname of the LogDog instance to use, e.g. "logs.chromium.org".
   229    string hostname = 1;
   230  }
   231  
   232  // ExperimentSettings controls all well-known global experiment values.
   233  message ExperimentSettings {
   234    message Experiment {
   235      // The name of the global experiment.
   236      string name = 1;
   237  
   238      // The default_value (% chance, 0 - 100) of the global experiment.
   239      //
   240      // This must be greater than or equal to minimum_value.
   241      int32 default_value = 2;
   242  
   243      // The minimum_value (% chance, 0 - 100) of the global experiment.
   244      //
   245      // This will override lower Builder-defined experiment values.
   246      int32 minimum_value = 3;
   247  
   248      // Allows temporary exclusion of builders from the experiment.
   249      // Each line here should have a corresponding bug to remove the exclusion.
   250      //
   251      // If a builder is excluded from this experiment, it acts as though
   252      // default_value and minimum_value are both 0.
   253      BuilderPredicate builders = 4;
   254  
   255      // If this is true it means that the experiment has no effect, and is safe
   256      // to stop setting in user configs. Additionally, Buildbucket will stop
   257      // setting this experiment negatively on Builds.
   258      //
   259      // When removing a global experiment, set this to true rather than removing
   260      // the experiment entirely, because Buildbucket still needs this to permit
   261      // (and ignore) user configs which still mention reserved experiments (e.g.
   262      // if we have "luci.something" which someone explicitly specifies, and we
   263      // ramp it to 100% and remove it from the global spec, Buildbucket will
   264      // start complaining that users are using a reserved experiment name, rather
   265      // than just ignoring it).
   266      //
   267      // If inactive experiments appear in user configurations, it may cause
   268      // warnings to be printed e.g. at config validation time and/or on the LUCI
   269      // UI, etc.
   270      bool inactive = 5;
   271    }
   272    repeated Experiment experiments = 1;
   273  }
   274  
   275  // A predicate for a builder.
   276  message BuilderPredicate {
   277    // OR-connected list of regular expressions for a string
   278    // "{project}/{bucket}/{builder}".
   279    // Each regex is wrapped in ^ and $ automatically.
   280    // Examples:
   281    //
   282    //   # All builders in "chromium" project
   283    //   regex: "chromium/.+"
   284    //   # A specific builder.
   285    //   regex: "infra/ci/infra-continuous-trusty-64"
   286    //
   287    // Defaults to [".*"].
   288    repeated string regex = 1;
   289  
   290    // Like regex field, but negation. Negation always wins.
   291    repeated string regex_exclude = 2;
   292  }
   293  
   294  message ResultDBSettings {
   295    // Hostname of the ResultDB instance to use, e.g. "results.api.cr.dev".
   296    string hostname = 1;
   297  }
   298  
   299  message CipdSettings {
   300    message Source {
   301      // CIPD package name, e.g. "infra/tools/cipd/${platform}"
   302      string package_name = 2;
   303      // CIPD instance version, e.g. "L34sd94gsdgs4gsd" or some hash.
   304      // Used for non-canary builds.
   305      string version = 3;
   306      // CIPD instance version for canary builds.
   307      // Defaults to version.
   308      string version_canary = 4;
   309    }
   310  
   311    // default CIPD server to use for this setting configuration,
   312    // e.g. "chrome-infra-packages.appspot.com".
   313    string server = 1;
   314  
   315    // Source of the cipd package itself
   316    Source source = 2;
   317  }