From 1a98850578577dfe8a20df84be5e1638dc682e8b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 16 Dec 2016 15:06:16 -0500 Subject: [PATCH] qa/tasks/workunit: retry on ceph.git if checkout fails Signed-off-by: Sage Weil (cherry picked from commit 72d73b8c8836ae35c518fa09f44805a74038f02a) --- qa/tasks/workunit.py | 46 ++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/qa/tasks/workunit.py b/qa/tasks/workunit.py index 5bc9cf1fd01c4..8320b24387860 100644 --- a/qa/tasks/workunit.py +++ b/qa/tasks/workunit.py @@ -309,19 +309,41 @@ def _run_tests(ctx, refspec, role, tests, env, subdir=None, timeout=None): srcdir = '{cdir}/qa/workunits'.format(cdir=clonedir) git_url = teuth_config.get_ceph_git_url() - remote.run( - logger=log.getChild(role), - args=[ - 'git', - 'clone', + try: + remote.run( + logger=log.getChild(role), + args=[ + 'git', + 'clone', + git_url, + clonedir, + run.Raw(';'), + 'cd', '--', clonedir, + run.Raw('&&'), + 'git', 'checkout', refspec, + ], + ) + except CommandFailedError: + alt_git_url = git_url.replace('ceph-ci', 'ceph') + log.info( + "failed to check out '%s' from %s; will also try in %s", + refspec, git_url, - clonedir, - run.Raw(';'), - 'cd', '--', clonedir, - run.Raw('&&'), - 'git', 'checkout', refspec, - ], - ) + alt_git_url, + ) + remote.run( + logger=log.getChild(role), + args=[ + 'git', + 'clone', + alt_git_url, + clonedir, + run.Raw(';'), + 'cd', '--', clonedir, + run.Raw('&&'), + 'git', 'checkout', refspec, + ], + ) remote.run( logger=log.getChild(role), -- 2.39.5