diff options
author | Tobias Henkel <tobias.henkel@bmw.de> | 2017-12-15 16:13:12 +0100 |
---|---|---|
committer | Tobias Henkel <tobias.henkel@bmw.de> | 2017-12-15 17:35:43 +0100 |
commit | 8904f17c32652baf425ab01fe034ac0959107af0 (patch) | |
tree | a42209ae52559b2c9bc669fa697d8f311b4a0321 | |
parent | 42f7d6f10084151d8aecb014effdde6eefa6ed8e (diff) | |
download | zuul-8904f17c32652baf425ab01fe034ac0959107af0.tar.gz |
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
-rw-r--r-- | zuul/driver/github/githubconnection.py | 6 |
1 files changed, 6 insertions, 0 deletions
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, |