From 27a718e32f7b6f4cdb1434125eb0485910b03e26 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Thu, 14 Nov 2019 14:22:21 -0500 Subject: [PATCH] Don't search github api for projects not in Zuul We see cases where the github driver uses the search API to learn more about an PR but ends up return information about other projects not in Zuuls configuration. In some cases, this results in zuul getting rate-limited by github, which can block event processing. Change-Id: Ie09eee17e1adf87c212da240eeaa8c098d48a1d6 Signed-off-by: Paul Belanger Co-Authored-By: Clark Boylan --- zuul/driver/github/githubconnection.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py index 9e368e3129..6536985377 100644 --- a/zuul/driver/github/githubconnection.py +++ b/zuul/driver/github/githubconnection.py @@ -1173,6 +1173,17 @@ class GithubConnection(BaseConnection): proj = pr.get('base').get('repo').get('full_name') sha = pr.get('head').get('sha') key = (proj, num, sha) + + # A single tenant could have multiple projects with the same + # name on different sources. Ensure we use the canonical name + # to handle that case. + s_project = self.source.getProject(proj) + trusted, t_project = tenant.getProject( + s_project.canonical_name) + # ignore projects zuul doesn't know about + if not t_project: + continue + if key in keys: continue self.log.debug("Found PR %s/%s needs %s/%s" %