go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cv/internal/gerrit/cfgmatcher/storage.proto (about)

     1  // Copyright 2020 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  syntax = "proto3";
    16  
    17  package cv.internal.gerrit.cfgmatcher;
    18  
    19  option go_package = "go.chromium.org/luci/cv/internal/gerrit/cfgmatcher;cfgmatcher";
    20  
    21  
    22  // Groups keeps config groups of a single LUCI project relevant to a specific
    23  // Git repository (aka Gerrit project).
    24  //
    25  // For now, this message is just a wrapper for a list of groups as they appear
    26  // in LUCI Project's CV config file. In the future, this can optimized into
    27  // treap-like structure based on known ref prefix if there are 100+ ref specs
    28  // for the same repo.
    29  message Groups {
    30    repeated Group groups = 1;
    31  }
    32  
    33  // Group represents one config group applied to just 1 Git repository.
    34  //
    35  // For full documentation, see ConfigGroup of api/config/v2/config.proto.
    36  message Group {
    37    // ConfigGroupID, as stored in ConfigGroup datastore entity.
    38    //
    39    // Used by gobmap.
    40    string id = 1;
    41    // Index of the ConfigGroup names interned in MatcherState.
    42    //
    43    // Used by MatcherState.
    44    int32 index = 3;
    45  
    46    // If set, this ConfigGroup will be selected if no other ConfigGroup matches
    47    // refspec. At most 1 group will have this set (this is validated before
    48    // config is injected).
    49    bool fallback = 2;
    50  
    51    // Regular expression that a CL's target ref must match. Required.
    52    //
    53    // It's constructed from `ref_regexp`s of CV config.
    54    string include = 13;
    55    // Regular expression that a CL's target ref must NOT match. Required.
    56    //
    57    // It's constructed from `ref_regexp_exclude`s of CV config.
    58    string exclude = 14;
    59  }
    60  
    61  // MatcherState is serializable state of a matcher for a single LUCI project at
    62  // specific config hash (version).
    63  message MatcherState {
    64    string config_hash = 1;
    65  
    66    // Interned config group names.
    67    //
    68    // Combine with config_hash to obtain config.ConfigGroupID.
    69    repeated string config_group_names = 2;
    70  
    71    // Maps Gerrit hosts to watched projects.
    72    map<string, Projects> hosts = 3;
    73  
    74    message Projects {
    75      // Maps Gerrit project (aka Gerrit repo) to one or more config groups.
    76      map<string, Groups> projects = 1;
    77    }
    78  }