From 6619d64269143398cc26dec0a0a9057056fdc4dd Mon Sep 17 00:00:00 2001 From: Tobias Henkel Date: Fri, 15 Dec 2017 16:28:12 +0100 Subject: [PATCH] Fix github app authentication in _getNeededByFromPR When running as a github app we must supply the project in order to do proper authentication as the installation. Otherwise we end up as an unauthenticated request which will be rejected by most GHE installations. A draw back currently is that the search will be scoped by the app installation (which is either a single repository or an organization). As a future improvement we might want to iterate over all installation and do the query. However this would need to be configurable as with many installations this quickly can become quite expensive. A different optimization could be searching in the local change cache. Change-Id: Iee7f009693dc8afa4631d2e48a630bb6da689aec --- zuul/driver/github/githubconnection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py index 61ee9c6a99..87a25b0faf 100644 --- a/zuul/driver/github/githubconnection.py +++ b/zuul/driver/github/githubconnection.py @@ -709,7 +709,8 @@ class GithubConnection(BaseConnection): change.project.name, change.number) query = '%s type:pr is:open in:body' % pattern - github = self.getGithubClient() + # FIXME(tobiash): find a way to query this for different installations + github = self.getGithubClient(change.project.name) for issue in github.search_issues(query=query): pr = issue.issue.pull_request().as_dict() if not pr.get('url'):