From 8904f17c32652baf425ab01fe034ac0959107af0 Mon Sep 17 00:00:00 2001 From: Tobias Henkel Date: Fri, 15 Dec 2017 16:13:12 +0100 Subject: Initialize github auth in getGitUrl if needed The executors and mergers don't initialize the github authentication upfront. However they call getGitUrl which gets unauthenticated if we run as a github app. So check and initialize the authentication and installation map. Change-Id: If05b9f8660cab1d78ac82ea0455aa24721f3a7e2 --- zuul/driver/github/githubconnection.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py index 0c8ac2ebb..4a22129d7 100644 --- a/zuul/driver/github/githubconnection.py +++ b/zuul/driver/github/githubconnection.py @@ -790,6 +790,12 @@ class GithubConnection(BaseConnection): if self.git_ssh_key: return 'ssh://git@%s/%s.git' % (self.server, project.name) + # if app_id is configured but self.app_id is empty we are not + # authenticated yet against github as app + if not self.app_id and self.connection_config.get('app_id', None): + self._authenticateGithubAPI() + self._prime_installation_map() + if self.app_id: installation_key = self._get_installation_key(project.name) return 'https://x-access-token:%s@%s/%s' % (installation_key, -- cgit v1.2.1