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
diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py
index 0c8ac2e..4a22129 100644
--- a/zuul/driver/github/githubconnection.py
+++ b/zuul/driver/github/githubconnection.py
@@ -790,6 +790,12 @@
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,