fix(ops/besadii): Don't send notifications for CI status

Don't notify reviewers ever on CI status changes, and only notify the
owner if the build fails.

Change-Id: If2cf63581b49e3de77181024ce8a4213031f4bd5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4337
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Autosubmit: grfn <grfn@gws.fyi>
This commit is contained in:
Griffin Smith 2021-12-15 13:51:44 -05:00 committed by grfn
parent 6b285f008d
commit 50b43cfb66

View file

@ -98,6 +98,7 @@ type reviewInput struct {
OmitDuplicateComments bool `json:"omit_duplicate_comments"`
IgnoreDefaultAttentionSetRules bool `json:"ignore_default_attention_set_rules"`
Tag string `json:"tag"`
Notify string `json:"notify,omitempty"`
}
func defaultConfigLocation() (string, error) {
@ -262,6 +263,8 @@ func triggerBuild(cfg *config, log *syslog.Writer, trigger *buildTrigger) error
// Do not update the attention set for this comment.
IgnoreDefaultAttentionSetRules: true,
Notify: "NONE",
}
updateGerrit(cfg, review, trigger.changeId, trigger.patchset)
@ -449,13 +452,16 @@ func postCommandMain(cfg *config) {
var vote int
var verb string
var notify string
if os.Getenv("BUILDKITE_COMMAND_EXIT_STATUS") == "0" {
vote = 1 // automation passed: +1 in Gerrit
verb = "passed"
notify = "NONE"
} else {
vote = -1
verb = "failed"
notify = "OWNER"
}
msg := fmt.Sprintf("Build of patchset %s %s: %s", patchset, verb, os.Getenv("BUILDKITE_BUILD_URL"))
@ -470,6 +476,8 @@ func postCommandMain(cfg *config) {
IgnoreDefaultAttentionSetRules: vote == 1,
Tag: "autogenerated:buildkite~result",
Notify: notify,
}
updateGerrit(cfg, review, changeId, patchset)
}