go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/scheduler/appengine/internal/triggers.proto (about) 1 // Copyright 2017 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 internal.triggers; 18 19 option go_package = "go.chromium.org/luci/scheduler/appengine/internal"; 20 21 import "google/protobuf/timestamp.proto"; 22 import "go.chromium.org/luci/scheduler/api/scheduler/v1/triggers.proto"; 23 24 25 // Trigger can be emitted by the engine itself (e.g. on a schedule) or by 26 // triggering tasks (such as Gitiles tasks). 27 // 28 // One or multiple triggers are consumed to initiate a new invocation which has 29 // access to the properties of consumed triggers. For example, Buildbucket task 30 // knows about triggers produced by Gitiles tasks. 31 // 32 // This message is an internal representation of the trigger, as stored in 33 // the datastore. See also triggers.Trigger for public representation used in 34 // API calls. 35 message Trigger { 36 // Unique in time identifier of the trigger. 37 // 38 // It is used to deduplicate and hence provide idempotency for adding 39 // a trigger. Must be provided by whoever emits the trigger. 40 string id = 1; 41 42 // ID of a job that emitted this trigger or "" if emitted by the engine. 43 // 44 // Set by the engine, can't be overridden. 45 string job_id = 2; 46 47 // ID of an invocation that emitted this trigger or 0 if emitted by the 48 // engine. 49 // 50 // Set by the engine, can't be overridden. 51 int64 invocation_id = 3; 52 53 // Timestamp when the trigger was created. 54 // 55 // Can be set by whoever emits the trigger if the trigger is based on some 56 // external event. If not provided, the engine will set it to the current 57 // time. 58 // 59 // Together with 'order_in_batch' used for weak ordering of triggers that 60 // aren't directly comparable (e.g. git commits from different repositories). 61 // This ordering shouldn't be considered reliable. 62 google.protobuf.Timestamp created = 4; 63 64 // If a bunch of triggers were emitted at the same moment in time (for example 65 // through a single RPC or by a single invocation in a tight loop), a trigger 66 // with smaller 'order_in_batch' is considered to be older. Value of 67 // 'order_in_batch' for triggers with different 'created' timestamps are not 68 // comparable. 69 // 70 // Should be set by whoever emits the trigger if 'created' timestamp was 71 // supplied explicitly. Otherwise will be set by the engine based on the order 72 // of EmitTrigger calls done by the invocation. 73 // 74 // Together with 'order_in_batch' used for weak ordering of triggers that 75 // aren't directly comparable (e.g. git commits from different repositories). 76 // This ordering shouldn't be considered reliable. 77 int64 order_in_batch = 7; 78 79 // User friendly name for this trigger that shows up in UI. 80 // 81 // Can be provided by whoever emits the trigger. Doesn't have to be unique. 82 string title = 5; 83 84 // Optional HTTP link to display in UI. 85 // 86 // Can be provided by whoever emits the trigger. Doesn't have to be unique. 87 string url = 6; 88 89 // For triggers emitted through public API or "Trigger" button, contains 90 // identity of a user who submitted this trigger. 91 // 92 // Empty for triggers emitted by the service itself. 93 string emitted_by_user = 8; 94 95 // Actual trigger data that depends on type of the trigger. 96 oneof payload { 97 scheduler.CronTrigger cron = 40; 98 scheduler.WebUITrigger webui = 41; 99 scheduler.NoopTrigger noop = 50; 100 scheduler.GitilesTrigger gitiles = 51; 101 scheduler.BuildbucketTrigger buildbucket = 52; 102 } 103 } 104 105 106 // TriggerList is what we store in datastore entities. 107 message TriggerList { 108 repeated Trigger triggers = 1; 109 }