jenkins-gerrit: tweak notify setting

Instead of notifying everybody listed as reviewers and in CC:
* notify the owner if the build failed
* notify nobody if the build was successful

Related: OS#2385
Change-Id: I7c6c183b98624eb75d5dccd9766ee3ff5568b06e
This commit is contained in:
Oliver Smith 2022-10-12 12:19:21 +02:00
parent 348751bc05
commit 5354547dff
1 changed files with 7 additions and 2 deletions

View File

@ -137,7 +137,8 @@ def get_pipeline_summary(build_url):
:returns: a dict that is expected by gerrit's set-review api, e.g.
{"tag": "jenkins",
"message": "...",
"labels": {"Code-Review": -1}} """
"labels": {"Code-Review": -1},
"notify": "OWNER"} """
summary = ""
pipeline = parse_pipeline(build_url)
@ -164,15 +165,19 @@ def get_pipeline_summary(build_url):
if jobs["failed"]:
summary += "Build Failed\n"
vote = -1
notify = "OWNER"
else:
summary += "Build Successful\n"
vote = 1
notify = "NONE"
# Reference:
# https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
# https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input
return {"tag": "jenkins",
"message": summary,
"labels": {"Verified": vote}}
"labels": {"Verified": vote},
"notify": notify}
def main():