Set remote url on every getRepo in merger
In case we run on github with apps we have an access token in the git
url. This access token is only valid for a specific period of
time. Currently the merger caches its repos and never changes the git
url on subsequent merge or cat requests. After timeout the merger then
faces an exception [1].
The fix is to update the remote url on every getRepo call in the
merger. This makes sure that we have a recent access token on every
merge or cat call.
Further the executor has the same problems and gets fixed by this too
as it also uses getRepo from the merger.
[1] Exception:
2017-12-20 07:00:00,874 ERROR zuul.Merger: Unable to update github/sandbox/sandbox
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/zuul/merger/merger.py", line 382, in updateRepo
repo.reset()
File "/usr/lib/python3.6/site-packages/zuul/merger/merger.py", line 143, in reset
self.update()
File "/usr/lib/python3.6/site-packages/zuul/merger/merger.py", line 293, in update
self._git_fetch(repo, 'origin', tags=True)
File "/usr/lib/python3.6/site-packages/zuul/merger/merger.py", line 133, in _git_fetch
**kwargs)
File "/usr/lib/python3.6/site-packages/git/cmd.py", line 551, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/git/cmd.py", line 1010, in _call_process
return self.execute(call, **exec_kwargs)
File "/usr/lib/python3.6/site-packages/git/cmd.py", line 821, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git fetch --tags origin
stderr: 'remote: Invalid username or password.
fatal: Authentication failed for 'https://x-access-token:v1.c8ec09e233b16871b64843adeec5fb048a383fba@github.example.com/sandbox/sandbox/''
Change-Id: If990dc48e6c10c24b6b32db5f5711fc3608bdfe4
3 files changed