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>
diff --git a/zuul/merger/merger.py b/zuul/merger/merger.py
index 8b98bfb..7b732c7 100644
--- a/zuul/merger/merger.py
+++ b/zuul/merger/merger.py
@@ -50,10 +50,14 @@
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