about summary refs log tree commit diff
path: root/ops/besadii/main.go
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-08-18T14·20-0400
committergrfn <grfn@gws.fyi>2021-08-24T13·00+0000
commit330b7067a0d63de38bc9e1cbf51306552c49f65e (patch)
treebc4aacad415509310df839b315d00fa593bde65e /ops/besadii/main.go
parent77be4dfe37d4a48e7a467c52dd5a00dbbd3f2bab (diff)
feat(besadii): Tag gerrit comments as autogenerated r/2757
This is a bit of an under-documented feature, but if the "tag" field for
a gerrit review starts with the string
"autogenerated:<something>~<something-else>", only the last comment per
instance of <something> will be shown by default on the CL page (with
the rest viewable by toggling the "Show all entries" switch). The idea
behind the "<something-else>" tag is to be used for the "type" of
comment within a particular system - gerrit's documentation gives the
example of one tag for "the build is running" and another for "the build
has finished, here's the result".

Change-Id: I9199a6ed97beca1b3a51ec5d6230c6c8358ba2b3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3374
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'ops/besadii/main.go')
-rw-r--r--ops/besadii/main.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/ops/besadii/main.go b/ops/besadii/main.go
index 7972df74dd..77c04099eb 100644
--- a/ops/besadii/main.go
+++ b/ops/besadii/main.go
@@ -54,10 +54,10 @@ type Author struct {
 // Build is the representation of a Buildkite build as described on
 // https://buildkite.com/docs/apis/rest-api/builds#create-a-build
 type Build struct {
-	Commit  string            `json:"commit"`
-	Branch  string            `json:"branch"`
-	Author  Author            `json:"author"`
-	Env     map[string]string `json:"env"`
+	Commit string            `json:"commit"`
+	Branch string            `json:"branch"`
+	Author Author            `json:"author"`
+	Env    map[string]string `json:"env"`
 }
 
 // Trigger a build of a given branch & commit on Buildkite
@@ -70,9 +70,9 @@ func triggerBuild(log *syslog.Writer, token string, update *refUpdated) error {
 	}
 
 	build := Build{
-		Commit:  update.commit,
-		Branch:  update.ref,
-		Env:     env,
+		Commit: update.commit,
+		Branch: update.ref,
+		Env:    env,
 		Author: Author{
 			Name:  update.submitter,
 			Email: update.email,
@@ -221,6 +221,7 @@ type reviewInput struct {
 	Labels                         map[string]int `json:"labels"`
 	OmitDuplicateComments          bool           `json:"omit_duplicate_comments"`
 	IgnoreDefaultAttentionSetRules bool           `json:"ignore_default_attention_set_rules"`
+	Tag                            string         `json:"tag"`
 }
 
 func postCommandMain() {
@@ -267,6 +268,8 @@ func postCommandMain() {
 
 		// Update the attention set if we are failing this patchset.
 		IgnoreDefaultAttentionSetRules: verified == 1,
+
+		Tag: "autogenerated:buildkite~result",
 	}
 
 	body, _ := json.Marshal(review)