go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/deploy/api/modelpb/deployment.proto (about) 1 // Copyright 2022 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 deploy.model; 18 19 option go_package = "go.chromium.org/luci/deploy/api/modelpb"; 20 21 import "google/protobuf/duration.proto"; 22 23 // Identifier of a deployment: a reference to its config location. 24 // 25 // A deployment is located in some directory of a git repository on `HEAD` ref. 26 // 27 // The directory path has two segments: the path to the root of the 28 // configuration tree, and the path to the particular configuration within this 29 // tree. 30 message DeploymentID { 31 // Hostname of the GoB server with the IaC repository, e.g. "chrome-internal". 32 string repo_host = 1; 33 // Name of the IaC repository relative to the host, e.g. "infradata/gae". 34 string repo_name = 2; 35 // Path to the root of the IaC config tree in the repository, e.g. ".". 36 string repo_path = 3; 37 // Path to the directory inside the IaC configs, e.g. "apps/luci-deploy/prod". 38 string config_path = 4; 39 } 40 41 42 // Deployment as defined in the IaC repo. 43 message Deployment { 44 // The stable identifier of the deployment based on the config location. 45 DeploymentID id = 1; 46 47 // The revision of the HEAD of IaC repository with the deployment. 48 // 49 // Can be obtained with `git rev-parse HEAD`. Moves frequently. 50 string repo_rev = 2; 51 52 // The revision of the deployment config directory. 53 // 54 // Can be obtained `git log --pretty=tformat:"%H" -n1 <config_path>`. If it 55 // changes, the deployment most like is changing too. 56 string config_rev = 3; 57 58 // Configuration for the deployment system itself, as defined in the IaC repo. 59 // 60 // Applies to all assets associated with this deployment. 61 DeploymentConfig config = 4; 62 63 // Details of the commit matching `config_rev`. 64 CommitDetails latest_commit = 5; 65 } 66 67 68 // Deployment configuration, as defined in the IaC repo. 69 message DeploymentConfig { 70 // How long the actuation can run before it is considered crashed. 71 // 72 // Default is 20 min. 73 google.protobuf.Duration actuation_timeout = 1; 74 75 // Who to notify on noteworthy events. 76 // 77 // Various asset state transitions emit 0 or more events per transition. For 78 // each event kind `notifications` define a set of destinations to send it 79 // to. During a state transition, all emitted events are bucketed by their 80 // destination, then redundant events are trimmed (e.g. if a single 81 // destination is getting ACTUATION_FIXED and ACTUATION_SUCCEEDED events, only 82 // ACTUATION_FIXED will be retained, since it makes little sense to send 83 // two success notifications to the same destination at the same time). 84 message Notification { 85 // Types of events to notify on. 86 enum Event { 87 EVENT_UNSPECIFIED = 0; 88 89 // An actuation is starting. 90 // 91 // Always emitted regardless of any prior history. 92 ACTUATION_STARTING = 1; 93 94 // An actuation has finished successfully. 95 // 96 // Always emitted regardless of any prior history. 97 ACTUATION_SUCCEEDED = 2; 98 99 // An actuation failed, perhaps after several retries. 100 // 101 // First few failures (below `consecutive_failures` threshold) will *not* 102 // result in an event. Every consecutive failure after that will result 103 // in an event. 104 ACTUATION_FAILED = 3; 105 106 // An actuation succeeded after a series of failures. 107 // 108 // Emitted if the actuation succeeded after >= `consecutive_failures` 109 // consecutive failures. Overrides ACTUATION_SUCCEEDED if emitted by the 110 // same state transition. 111 ACTUATION_FIXED = 4; 112 } 113 repeated Event events = 1; 114 115 // List of emails to send notifications to. 116 repeated string emails = 2; 117 118 // List of Google Chat spaces to send notifications to. 119 message ChatSpace { 120 // Space ID e.g. "AAAA9ulaM5M", can be extracted from the Space URL. 121 // 122 // The chat app needs to be added into the space first. Search for it 123 // using "LUCI Deploy" title. 124 string id = 1; 125 } 126 repeated ChatSpace chat_spaces = 3; 127 128 // Consecutive failures threshold for ACTUATION_FAILED and ACTUATION_FIXED. 129 // 130 // First few failures (below the threshold) will *not* result in 131 // a notification. This is useful to avoid spamming on flaky failures 132 // resolved by automatic retries. 133 int32 consecutive_failures = 4; 134 } 135 repeated Notification notifications = 2; 136 } 137 138 139 // Details of an IaC repo commit, to show in the UI. 140 message CommitDetails { 141 // Author name, as git understands it. 142 string author_name = 1; 143 // Author email, as git understands it. 144 string author_email = 2; 145 // Full commit message, including subject and footers. 146 string commit_message = 3; 147 }