Add git timeout for HTTP(S) operations

Using the GIT_HTTP_LOW_SPEED_LIMIT and GIT_HTTP_LOW_SPEED_TIME
environmental variables, we have the ability to support timeouts via
HTTP(S) for git.  Currently, it is possible for a merger to block for
ever if something happens to the network.

Change-Id: I8ab245b221eae3a9faacd0b9ba6f7b14b27e6b0e
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-10-05 14:50:31 -04:00
parent 29a8c23090
commit 06ab26d80c
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 7 additions and 3 deletions

View File

@ -50,10 +50,14 @@ class Repo(object):
self.log = logging.getLogger("zuul.Repo")
else:
self.log = logger
# TODO(pabelanger): Expose to user via zuul.conf.
self.env = {
'GIT_HTTP_LOW_SPEED_LIMIT': '1000',
'GIT_HTTP_LOW_SPEED_TIME': '30',
}
if sshkey:
self.env = {'GIT_SSH_COMMAND': 'ssh -i %s' % (sshkey,)}
else:
self.env = {}
self.env['GIT_SSH_COMMAND'] = 'ssh -i %s' % (sshkey,)
self.remote_url = remote
self.local_path = local
self.email = email