Skip to content

Commit

Permalink
Remove DEFAULT_GIT_CLONE_TIMEOUT
Browse files Browse the repository at this point in the history
Signed-off-by: Vector Li <[email protected]>
  • Loading branch information
idorax committed Nov 6, 2023
1 parent 9448786 commit 6a8a836
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ TMT_GIT_CLONE_RETRIES

TMT_GIT_CLONE_TIMEOUT
Variable used to specify the timeout when cloning git repositories.
By default, its value is 3600 seconds.
By default, the variable is not set.

Step Variables
--------------
Expand Down
11 changes: 7 additions & 4 deletions tmt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ def is_pidfile(cls, exit_code: Optional[int]) -> bool:

# Defaults for GIT retries and timeouts
DEFAULT_GIT_CLONE_RETRIES = 9
DEFAULT_GIT_CLONE_TIMEOUT = 3600

# A stand-in variable for generic use.
T = TypeVar('T')
Expand Down Expand Up @@ -4840,8 +4839,9 @@ def git_clone(

retries = retries or int(os.environ.get('TMT_GIT_CLONE_RETRIES',
str(DEFAULT_GIT_CLONE_RETRIES)))
timeout = timeout or int(os.environ.get('TMT_GIT_CLONE_TIMEOUT',
str(DEFAULT_GIT_CLONE_TIMEOUT)))
if timeout is None:
value = os.environ.get('TMT_GIT_CLONE_TIMEOUT', None)
timeout = None if value is None else int(value)

if can_change:
url = clonable_git_url(url)
Expand All @@ -4855,7 +4855,10 @@ def git_clone(
), env=env, timeout=timeout)
except RunError:
if not retries:
raise
# Do not raise because of negative test. For example,
# git clone https://github.com/beakerlib/THISDOESNTEXIST
# is expected to exit quietly.
return
if not shallow:
# Do not retry if shallow was not used
raise
Expand Down

0 comments on commit 6a8a836

Please sign in to comment.