| // Copyright 2020 The LUCI Authors. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| syntax = "proto3"; |
| |
| package cv.gerrit.cfgmatcher; |
| |
| option go_package = "go.chromium.org/luci/cv/internal/gerrit/cfgmatcher;cfgmatcher"; |
| |
| |
| // Groups keeps config groups of a single LUCI project relevant to a specific |
| // Git repository (aka Gerrit project). |
| // |
| // For now, this message is just a wrapper for a list of groups as they appear |
| // in LUCI Project's CV config file. In the future, this can optimized into |
| // treap-like structure based on known ref prefix if there are 100+ ref specs |
| // for the same repo. |
| message Groups { |
| repeated Group groups = 1; |
| } |
| |
| // Group represents one config group applied to just 1 Git repository. |
| // |
| // For full documentation, see ConfigGroup of api/config/v2/cq.proto. |
| message Group { |
| // ConfigGroupID, as stored in ConfigGroup datastore entity. |
| // |
| // Used by gobmap. |
| string id = 1; |
| // Index of the ConfigGroup names interned in MatcherState. |
| // |
| // Used by MatcherState. |
| int32 index = 3; |
| |
| // If set, this ConfigGroup will be selected if no other ConfigGroup matches |
| // refspec. At most 1 group will have this set (this is validated before |
| // config is injected). |
| bool fallback = 2; |
| |
| // Regular expression that a CL's target ref must match. Required. |
| // |
| // It's constructed from `ref_regexp`s of CV config. |
| string include = 13; |
| // Regular expression that a CL's target ref must NOT match. Required. |
| // |
| // It's constructed from `ref_regexp_exclude`s of CV config. |
| string exclude = 14; |
| } |
| |
| // MatcherState is serializable state of a matcher for a single LUCI project at |
| // specific config hash (version). |
| message MatcherState { |
| string config_hash = 1; |
| |
| // Interned config group names. |
| // |
| // Combine with config_hash to obtain config.ConfigGroupID. |
| repeated string config_group_names = 2; |
| |
| // Maps Gerrit hosts to watched projects. |
| map<string, Projects> hosts = 3; |
| |
| message Projects { |
| // Maps Gerrit project (aka Gerrit repo) to one or more config groups. |
| map<string, Groups> projects = 1; |
| } |
| } |