summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-04 16:33:46 +0000
committerGerrit Code Review <review@openstack.org>2019-02-04 16:33:46 +0000
commit86d6a46beab1c6c2cb8f120cc26aff73fc944fc9 (patch)
treec5958977f727d07f3b5d635f933c00fed552080a
parentb44b6c532ce9a999b135d909ae9f9caf0671784d (diff)
parente69c9fe97b764a18c2cc1bf4d3287dbdfdc40fc8 (diff)
Merge "Make git clone timeout configurable"
-rw-r--r--doc/source/admin/components.rst10
-rw-r--r--zuul/configloader.py2
-rw-r--r--zuul/executor/server.py3
-rw-r--r--zuul/merger/client.py2
-rw-r--r--zuul/merger/merger.py6
-rw-r--r--zuul/merger/server.py3
6 files changed, 21 insertions, 5 deletions
diff --git a/doc/source/admin/components.rst b/doc/source/admin/components.rst
index be6fd52..c0038a8 100644
--- a/doc/source/admin/components.rst
+++ b/doc/source/admin/components.rst
@@ -373,6 +373,16 @@ The following section of ``zuul.conf`` is used by the merger:
373 373
374 Value in seconds, setting to 0 will disable. 374 Value in seconds, setting to 0 will disable.
375 375
376 .. attr:: git_timeout
377 :default: 300
378
379 Timeout for git clone and fetch operations. This can be useful when
380 dealing with large repos. Note that large timeouts can increase startup
381 and reconfiguration times if repos are not cached so be cautious when
382 increasing this value.
383
384 Value in seconds.
385
376 .. attr:: git_user_email 386 .. attr:: git_user_email
377 387
378 Value to pass to `git config user.email 388 Value to pass to `git config user.email
diff --git a/zuul/configloader.py b/zuul/configloader.py
index 5e4afc0..ca5cf5e 100644
--- a/zuul/configloader.py
+++ b/zuul/configloader.py
@@ -1587,7 +1587,7 @@ class TenantParser(object):
1587 1587
1588 for job in jobs: 1588 for job in jobs:
1589 self.log.debug("Waiting for cat job %s" % (job,)) 1589 self.log.debug("Waiting for cat job %s" % (job,))
1590 job.wait() 1590 job.wait(self.merger.git_timeout)
1591 if not job.updated: 1591 if not job.updated:
1592 raise Exception("Cat job %s failed" % (job,)) 1592 raise Exception("Cat job %s failed" % (job,))
1593 self.log.debug("Cat job %s got files %s" % 1593 self.log.debug("Cat job %s got files %s" %
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index 219c234..c46dd11 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -2152,6 +2152,7 @@ class ExecutorServer(object):
2152 config, 'merger', 'git_http_low_speed_limit', '1000') 2152 config, 'merger', 'git_http_low_speed_limit', '1000')
2153 self.merge_speed_time = get_default( 2153 self.merge_speed_time = get_default(
2154 config, 'merger', 'git_http_low_speed_time', '30') 2154 config, 'merger', 'git_http_low_speed_time', '30')
2155 self.git_timeout = get_default(config, 'merger', 'git_timeout', 300)
2155 # If the execution driver ever becomes configurable again, 2156 # If the execution driver ever becomes configurable again,
2156 # this is where it would happen. 2157 # this is where it would happen.
2157 execution_wrapper_name = 'bubblewrap' 2158 execution_wrapper_name = 'bubblewrap'
@@ -2228,7 +2229,7 @@ class ExecutorServer(object):
2228 return zuul.merger.merger.Merger( 2229 return zuul.merger.merger.Merger(
2229 root, self.connections, self.merge_email, self.merge_name, 2230 root, self.connections, self.merge_email, self.merge_name,
2230 self.merge_speed_limit, self.merge_speed_time, cache_root, logger, 2231 self.merge_speed_limit, self.merge_speed_time, cache_root, logger,
2231 execution_context=True) 2232 execution_context=True, git_timeout=self.git_timeout)
2232 2233
2233 def start(self): 2234 def start(self):
2234 self._running = True 2235 self._running = True
diff --git a/zuul/merger/client.py b/zuul/merger/client.py
index d534489..b5b0590 100644
--- a/zuul/merger/client.py
+++ b/zuul/merger/client.py
@@ -85,6 +85,8 @@ class MergeClient(object):
85 self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca, 85 self.gearman.addServer(server, port, ssl_key, ssl_cert, ssl_ca,
86 keepalive=True, tcp_keepidle=60, 86 keepalive=True, tcp_keepidle=60,
87 tcp_keepintvl=30, tcp_keepcnt=5) 87 tcp_keepintvl=30, tcp_keepcnt=5)
88 self.git_timeout = get_default(
89 self.config, 'merger', 'git_timeout', 300)
88 self.log.debug("Waiting for gearman") 90 self.log.debug("Waiting for gearman")
89 self.gearman.waitForServer() 91 self.gearman.waitForServer()
90 self.jobs = set() 92 self.jobs = set()
diff --git a/zuul/merger/merger.py b/zuul/merger/merger.py
index 0c14fbf..c6eccaf 100644
--- a/zuul/merger/merger.py
+++ b/zuul/merger/merger.py
@@ -496,7 +496,7 @@ class Repo(object):
496class Merger(object): 496class Merger(object):
497 def __init__(self, working_root, connections, email, username, 497 def __init__(self, working_root, connections, email, username,
498 speed_limit, speed_time, cache_root=None, logger=None, 498 speed_limit, speed_time, cache_root=None, logger=None,
499 execution_context=False): 499 execution_context=False, git_timeout=300):
500 self.logger = logger 500 self.logger = logger
501 if logger is None: 501 if logger is None:
502 self.log = logging.getLogger("zuul.Merger") 502 self.log = logging.getLogger("zuul.Merger")
@@ -510,6 +510,7 @@ class Merger(object):
510 self.username = username 510 self.username = username
511 self.speed_limit = speed_limit 511 self.speed_limit = speed_limit
512 self.speed_time = speed_time 512 self.speed_time = speed_time
513 self.git_timeout = git_timeout
513 self.cache_root = cache_root 514 self.cache_root = cache_root
514 # Flag to determine if the merger is used for preparing repositories 515 # Flag to determine if the merger is used for preparing repositories
515 # for job execution. This flag can be used to enable executor specific 516 # for job execution. This flag can be used to enable executor specific
@@ -528,7 +529,8 @@ class Merger(object):
528 cache_path = None 529 cache_path = None
529 repo = Repo( 530 repo = Repo(
530 url, path, self.email, self.username, self.speed_limit, 531 url, path, self.email, self.username, self.speed_limit,
531 self.speed_time, sshkey, cache_path, self.logger) 532 self.speed_time, sshkey=sshkey, cache_path=cache_path,
533 logger=self.logger, git_timeout=self.git_timeout)
532 534
533 self.repos[key] = repo 535 self.repos[key] = repo
534 except Exception: 536 except Exception:
diff --git a/zuul/merger/server.py b/zuul/merger/server.py
index bdb3cc5..fc8942d 100644
--- a/zuul/merger/server.py
+++ b/zuul/merger/server.py
@@ -41,9 +41,10 @@ class MergeServer(object):
41 config, 'merger', 'git_http_low_speed_limit', '1000') 41 config, 'merger', 'git_http_low_speed_limit', '1000')
42 speed_time = get_default( 42 speed_time = get_default(
43 config, 'merger', 'git_http_low_speed_time', '30') 43 config, 'merger', 'git_http_low_speed_time', '30')
44 git_timeout = get_default(config, 'merger', 'git_timeout', 300)
44 self.merger = merger.Merger( 45 self.merger = merger.Merger(
45 merge_root, connections, merge_email, merge_name, speed_limit, 46 merge_root, connections, merge_email, merge_name, speed_limit,
46 speed_time) 47 speed_time, git_timeout=git_timeout)
47 self.command_map = dict( 48 self.command_map = dict(
48 stop=self.stop) 49 stop=self.stop)
49 command_socket = get_default( 50 command_socket = get_default(