Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion buildbot/osuosl/master/config/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def getReporters():

r.append(
utils.LLVMFailGitHubLabeler(
debug = True,
token = token,
generators = [
utils.LLVMFailBuildGenerator(
Expand Down
30 changes: 15 additions & 15 deletions zorg/buildbot/reporters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def _extract_issue(self, props): # override
log.msg(f"{self.name}._extract_issue: INFO: issue={issue}")
return issue

@defer.inlineCallbacks
def is_wrong_issue(self, repo_user, repo_name, sha, issue):
# Users could reference wrong PRs in commit messages.
# So, to make sure we are commenting the correct one we need to check
Expand All @@ -316,6 +317,7 @@ def is_wrong_issue(self, repo_user, repo_name, sha, issue):
log.msg(
f"{self.name}.is_wrong_issue: WARNING: Skipped adding the comment for repo {repo_name}, issue is not specified."
)
yield
return wrong_issue

page = 1
Expand All @@ -339,7 +341,7 @@ def is_wrong_issue(self, repo_user, repo_name, sha, issue):
break

log.msg(
f"{self.name}.is_wrong_issue: WARNING: Got events list for PR#{issue} (page {page}): {events}."
f"{self.name}.is_wrong_issue: INFO: Got events list for PR#{issue} (page {page}): {events}."
)

for event in events:
Expand Down Expand Up @@ -371,7 +373,8 @@ def createStatus(
issue=None,
description=None,
): # override
if self.is_wrong_issue(repo_user, repo_name, sha, issue):
wrong_issue = yield self.is_wrong_issue(repo_user, repo_name, sha, issue)
if wrong_issue:
return None

# This is the right issue to comment.
Expand All @@ -381,12 +384,10 @@ def createStatus(
url = "/".join(["/repos", repo_user, repo_name, "issues", issue, "comments"])
log.msg(f"{self.name}.createStatus: INFO: http.post({url})")

# Use utils.LLVMFailGitHubReporter(debug=True, ...) to simulate the process.
if self.debug:
yield
ret = None
else:
ret = yield self._http.post(url, json=payload)
# Never use debug=True in GitHubStatusPush and inherited classes.
# It will cause unexpected exceptions inside HTTP client service.

ret = yield self._http.post(url, json=payload)
return ret


Expand Down Expand Up @@ -431,7 +432,8 @@ def createStatus(
issue=None,
description=None,
): # override
if self.is_wrong_issue(repo_user, repo_name, sha, issue):
wrong_issue = yield self.is_wrong_issue(repo_user, repo_name, sha, issue)
if wrong_issue:
return None

# This is the right issue to label.
Expand All @@ -446,10 +448,8 @@ def createStatus(
url = "/".join(["/repos", repo_user, repo_name, "issues", issue, "labels"])
log.msg(f"{self.name}.createStatus: INFO: http.post({url}), label={description}")

# Use utils.LLVMFailGitHubLabeler(debug=True, ... ) to simulate the process.
if self.debug:
yield
ret = None
else:
ret = yield self._http.post(url, json=payload)
# Never use debug=True in GitHubStatusPush and inherited classes.
# It will cause unexpected exceptions inside HTTP client service.

ret = yield self._http.post(url, json=payload)
return ret