go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cv/api/recipe/v1/cq.proto (about)

     1  // Copyright 2019 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 cq.recipe;
    18  
    19  option go_package = "go.chromium.org/luci/cv/api/recipe/v1;recipe";
    20  
    21  // Input provides CQ metadata for CQ-triggered tryjob.
    22  message Input {
    23    // If true, CQ is active for the current build. CQ is considered "active" for
    24    // a build if CQ triggered the build, either directly or indirectly.
    25    bool active = 1;
    26  
    27    // If false, CQ would try to submit CL(s) if all other checks pass.
    28    // If true, CQ won't try to submit.
    29    //
    30    // DEPRECATED: Use run_mode instead.
    31    bool dry_run = 2;
    32  
    33    // If true, CQ will not take this build into account while deciding whether
    34    // CL is good or not. See also `experiment_percentage` of CQ's config file.
    35    bool experimental = 3;
    36  
    37    // If true, CQ triggered this build directly, otherwise typically indicates a
    38    // child build triggered by a CQ triggered one (possibly indirectly).
    39    //
    40    // Can be spoofed. *DO NOT USE FOR SECURITY CHECKS.*
    41    //
    42    // One possible use is to distinguish which builds must be cancelled manually,
    43    // and which (top_level=True) CQ would cancel itself.
    44    bool top_level = 4;
    45  
    46    // The mode of the CQ Run that triggers this Tryjob.
    47    string run_mode = 5;
    48  
    49    // Tells whether the Run owner is a Googler.
    50    //
    51    // DO NOT USE: This is a temporary workaround for crbug/1259887 which
    52    // is supposed to be used by Chromium only.
    53    // TODO(crbug/1382195): Remove this field after long term solution is
    54    // ready.
    55    bool owner_is_googler = 20;
    56  }
    57  
    58  // Output provides build-specific instructions back to CQ.
    59  //
    60  // Unless stated otherwise, each Output message field can be set even on builds
    61  // not triggered directly or indirectly by CQ itself. For example, `git cl try`
    62  // or Gerrit UI can be used to trigger a build directly, which can then instruct
    63  // CQ not to retry it.
    64  //
    65  // CQ periodically checks the Output of still running builds, too,
    66  // and may act on the Output even before a build is completed.
    67  message Output {
    68  
    69    // Buildbucket build IDs which this build has triggered for CQ to wait on.
    70    //
    71    // Required when using triggered_by builders in project's CQ config.
    72    // This is useful to allow the triggering builder to finish without waiting
    73    // for its child builds, which can be efficiently done by CQ.
    74    //
    75    // This is equivalent to setting legacy top-level "triggered_build_ids" output
    76    // property.
    77    // TODO(tandrii): deprecate and remove the legacy property.
    78    repeated int64 triggered_build_ids = 1;
    79  
    80    enum Retry {
    81      OUTPUT_RETRY_UNSPECIFIED = 0;
    82      // Default. Allow CQ to retry the build.
    83      //
    84      // Does NOT force CQ to retry this build, since it depends on other factors,
    85      // such as the applicable project's CQ config.
    86      OUTPUT_RETRY_ALLOWED = 1;
    87      // Denies retries regardless of other factors.
    88      //
    89      // This is equivalent to setting legacy top-level `"do_not_retry": true`
    90      // output property.
    91      // TODO(tandrii): deprecate and remove the legacy property.
    92      OUTPUT_RETRY_DENIED = 2;
    93    }
    94    // Retry controls whether this build can be retried by CQ.
    95    Retry retry = 2;
    96  
    97    message Reuse {
    98      // Regular expression for modes of Runs for which this Reuse block applies.
    99      // Required.
   100      //
   101      // Implicitly wrapped with (?i)^...$  (= complete case-insensitive match).
   102      //
   103      // For example,
   104      //   ".+" will match all modes of Runs,
   105      //   "dryrun" and "fullrun" will match only Dry and Full runs, respectively.
   106      string mode_regexp = 1;
   107      // If deny is true, then reuse of this build in the future Runs of the
   108      // matched mode is not allowed.
   109      //
   110      // If false, then reuse is allowed. It's useful to stop the matching in case
   111      // of several Reuse messages.
   112      bool deny = 2;
   113    }
   114    // Reuse restricts potential reuse of this build by a later CQ run.
   115    //
   116    // DEPRECATED in favor of `reusability`.
   117    // TODO(crbug/1225047): Remove this after CQDaemon is decommissioned. For now,
   118    // CQDaemon will still use this field to decide reusability.
   119    //
   120    // NOTE: even if reuse is not restricted here, reuse is still subject to other
   121    // restrictions in applicable project's CQ config.
   122    //
   123    // If empty (default), reuse is *allowed*.
   124    //
   125    // If specified, the order matters: the first matching Reuse message wins.
   126    // If specified and no Reuse match the run, reuse is *not allowed*.
   127    // If any individual Reuse block is invalid, reuse is *not allowed*.
   128    //
   129    // Examples:
   130    //
   131    //  1. To prohibit reuse only for Full runs, do:
   132    //     {mode_regexp: "fullrun" deny: true}
   133    //     {mode_regexp: ".+"      deny: false}
   134    //
   135    //  2. To prohibit reuse for everything except Dry Runs, do:
   136    //     {mode_regexp: "dryrun"}
   137    repeated Reuse reuse = 3 [deprecated=true];
   138  
   139    message Reusability {
   140      // mode_allowlist specifies modes of LUCI CV Runs that can reuse this build.
   141      //
   142      // If not provided (or empty), all modes are *allowed* for reuse.
   143      repeated string mode_allowlist = 4;
   144  
   145      // TODO(yiwzhang): Consider adding mode_denylist if necessary.
   146      // TODO(crbug/753103): add reuse duration or deadline.
   147    }
   148  
   149    // Reusability restricts potential reuse of this build by a later LUCI CV run.
   150    //
   151    // NOTE: even if reuse is not restricted here, reuse is still subject to other
   152    // restrictions in applicable project's CQ config.
   153    //
   154    // If not specified, reuse is *allowed*.
   155    Reusability reusability = 4;
   156  }