go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/luci_notify/api/config/notify.proto (about) 1 // Copyright 2017 The LUCI Authors. All rights reserved. 2 // Use of this source code is governed under the Apache License, Version 2.0 3 // that can be found in the LICENSE file. 4 5 // Schema for project-level configuration in luci-notify. 6 7 // luci-notify users can define custom email templates, 8 // see 9 // [email_templates.md](https://chromium.googlesource.com/infra/luci/luci-go/+/HEAD/luci_notify/doc/email_templates.md) 10 11 syntax = "proto3"; 12 13 package notify; 14 15 import "go.chromium.org/luci/buildbucket/proto/build.proto"; 16 import "go.chromium.org/luci/buildbucket/proto/common.proto"; 17 import "go.chromium.org/luci/buildbucket/proto/step.proto"; 18 import "go.chromium.org/luci/common/proto/options.proto"; 19 20 option go_package = "go.chromium.org/luci/luci_notify/api/config"; 21 option (luci.file_metadata) = { 22 doc_url: "https://config.luci.app/schemas/projects:luci-notify.cfg" 23 }; 24 25 // ProjectConfig is a luci-notify configuration for a particular project. 26 message ProjectConfig { 27 // Notifiers is a list of Notifiers which watch builders and send 28 // notifications for this project. 29 repeated Notifier notifiers = 1; 30 31 // If false, then LUCI-Notify won't actually close trees, only log what 32 // actions it would have taken. 33 bool tree_closing_enabled = 2; 34 } 35 36 // Notifier contains a set of notification configurations (which specify 37 // triggers to send notifications on) and a set of builders that will be 38 // watched for these triggers. 39 message Notifier { 40 // Name is an identifier for the notifier which must be unique within a 41 // project. 42 // 43 // Name must additionally match ^[a-z\-]+$, meaning it must only 44 // use an alphabet of lowercase characters and hyphens. 45 // 46 // Required. 47 string name = 1; 48 49 // Notifications is a list of notification configurations. 50 repeated Notification notifications = 2; 51 52 // Builders is a list of buildbucket builders this Notifier should watch. 53 repeated Builder builders = 3; 54 55 // A list of tree closing rules to execute for this notifier. 56 repeated TreeCloser tree_closers = 4; 57 } 58 59 // Notification specifies the triggers to watch for and send 60 // notifications on. It also specifies email recipients. 61 // 62 // Next ID: 13. 63 message Notification { 64 reserved 8; 65 66 // Email is a message representing a set of mail recipients. 67 message Email { 68 // Recipients is a list of email addresses to notify. 69 repeated string recipients = 1; 70 71 // A list of rotations, for each of which we should notify the currently 72 // active member. 73 repeated string rotation_urls = 3; 74 75 reserved 2; 76 } 77 78 // Blamelist is a message representing configuration for notifying the 79 // blamelist. 80 message Blamelist { 81 // A list of repositories which we are allowed to be included as part of the 82 // blamelist. If unset, a blamelist will be computed based on a Builder's 83 // repository field. If set, however luci-notify computes the blamelist for 84 // all commits related to a build (which may span multiple repositories) 85 // which are part of repository in this repository allowlist. 86 // 87 // Repositories should be valid Gerrit/Gitiles repository URLs, such as 88 // https://chromium.googlesource.com/chromium/src 89 // Optional 90 repeated string repository_allowlist = 2; 91 92 reserved 1; 93 } 94 95 // Deprecated. Notify on each build success. 96 bool on_success = 1; 97 98 // Deprecated. Notify on each build failure. 99 bool on_failure = 2; 100 101 // Deprecated. Notify on each build status different than the previous one. 102 bool on_change = 3; 103 104 // Deprecated. Notify on each build failure unless the previous build was a 105 // failure. 106 bool on_new_failure = 7; 107 108 // Notify on each build with a specified status. 109 repeated buildbucket.v2.Status on_occurrence = 9; 110 111 // Notify on each build with a specified status different than the previous 112 // one. 113 repeated buildbucket.v2.Status on_new_status = 10; 114 115 // Notify only on builds which had a failing step matching this regular 116 // expression. Mutually exclusive with "on_new_status". 117 string failed_step_regexp = 11; 118 119 // Notify only on builds which don't have a failing step matching this regular 120 // expression. May be combined with "failed_step_regexp", in which case it 121 // must also have a failed step matching that regular expression. Mutually 122 // exclusive with "on_new_status". 123 string failed_step_regexp_exclude = 12; 124 125 // Email is the set of email addresses to notify. 126 // 127 // Optional. 128 Email email = 4; 129 130 // Refers to which project template name to use to format this email. 131 // If not present, "default" will be used. 132 // 133 // Optional. 134 string template = 5; 135 136 // NotifyBlamelist specifies whether to notify the computed blamelist for a 137 // given build. 138 // 139 // If set, this notification will be sent to the blamelist of a build. Note 140 // that if this is set in multiple notifications pertaining to the same 141 // builder, the blamelist may receive multiple emails. 142 // 143 // Optional. 144 Blamelist notify_blamelist = 6; 145 } 146 147 // TreeCloser represents an action which closes a tree, by interfacing with an 148 // instance of the tree-status app. 149 message TreeCloser { 150 // DEPRECATED: The hostname of the tree-status instance which this rule opens and closes. 151 // This is being replaced by the tree_name field below. For the migration period, 152 // well known values of this field will be automatically translated to values of 153 // the tree_name field. 154 string tree_status_host = 1; 155 156 // Close the tree only on builds which had a failing step matching this 157 // regular expression. 158 string failed_step_regexp = 2; 159 160 // Close the tree only on builds which don't have a failing step matching this 161 // regular expression. May be combined with "failed_step_regexp", in which 162 // case it must also have a failed step matching that regular expression. 163 string failed_step_regexp_exclude = 3; 164 165 // Refers to which project template name to use to format this email. 166 // If not present, "default_tree_status" will be used. 167 string template = 4; 168 169 // The identifier of the tree to close. 170 // Must match the regexp [a-z](?:[a-z0-9-]{0,61}[a-z0-9])?. 171 // 172 // Once tree_status_host field is removed, this field will be required. 173 // If this field is not provided, a value will be created based on the list of 174 // known status app instances as at 2024-01-01. 175 // ie. if this field is empty but tree_status_host is 'https://chromium-status.appspot.com' 176 // This field will be given the value 'chromium'. 177 string tree_name = 5; 178 } 179 180 // Builder references a buildbucket builder in the current project. 181 message Builder { 182 // Bucket is the buildbucket bucket that the builder is a part of. 183 // 184 // Required. 185 string bucket = 1; 186 187 // Name is the name of the buildbucket builder. 188 // 189 // Required. 190 string name = 2; 191 192 // Repository is the git repository associated with this particular builder. 193 // 194 // The repository should look like a URL, e.g. 195 // https://chromium.googlesource.com/src 196 // 197 // Currently, luci-notify only supports Gerrit-like URLs since it checks 198 // against gitiles commits, so the URL's path (e.g. "src" in the above 199 // example) should map directly to a Gerrit project. 200 // 201 // Builds attached to the history of this repository will use this 202 // repository's git history to determine the order between two builds for the 203 // OnChange notification. 204 // 205 // Optional. 206 // 207 // If not set, OnChange notifications will derive their notion of 208 // "previous" build solely from build creation time, which is potentially 209 // less reliable. 210 string repository = 3; 211 } 212 213 // Notifications encapsulates a list of notifications as a proto so code for 214 // storing it in the datastore may be generated. 215 message Notifications { 216 // Notifications is a list of notification configurations. 217 repeated Notification notifications = 1; 218 } 219 220 // A collection of landed Git commits hosted on Gitiles. 221 message GitilesCommits { 222 // The Gitiles commits in this collection. 223 repeated buildbucket.v2.GitilesCommit commits = 1; 224 } 225 226 // Input to an email template. 227 message TemplateInput { 228 // Buildbucket hostname, e.g. "cr-buildbucket.appspot.com". 229 string buildbucket_hostname = 1; 230 // The completed build. 231 buildbucket.v2.Build build = 2; 232 // State of the previous build in this builder. 233 buildbucket.v2.Status old_status = 3; 234 // The failed steps that passed the given regexes (see the fields 235 // "failed_step_regexp" and "failed_step_regexp_exclude" above). If that field 236 // wasn't supplied, this will be empty. 237 repeated buildbucket.v2.Step matching_failed_steps = 4; 238 }