Skip to content

Add retry to handle git clone failure #5240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tools/test/examples/examples_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def source_repos(config, examples):

subprocess.call(["mbed-cli", "import", repo_info['repo']])

def clone_repos(config, examples):
def clone_repos(config, examples , retry = 3):
""" Clones each of the repos associated with the specific examples name from the
json config file. Note if there is already a clone of the repo then it will first
be removed to ensure a clean, up to date cloning.
Expand All @@ -185,8 +185,11 @@ def clone_repos(config, examples):
if os.path.exists(name):
print("'%s' example directory already exists. Deleting..." % name)
rmtree(name)

subprocess.call([repo_info['type'], "clone", repo_info['repo']])
for i in range(0, retry):
if subprocess.call([repo_info['type'], "clone", repo_info['repo']]) == 0:
break
else:
print("ERROR : unable to clone the repo {}".format(name))

def deploy_repos(config, examples):
""" If the example directory exists as provided by the json config file,
Expand Down