From: Kefu Chai Date: Mon, 27 Feb 2017 08:29:40 +0000 (+0800) Subject: qa/tasks/workunit: use ceph.git as an alternative of ceph-ci.git for workunit repo X-Git-Tag: v11.2.1~154^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=63153e957862ac0b46b8a205ed81d319b66ea6f5;p=ceph.git qa/tasks/workunit: use ceph.git as an alternative of ceph-ci.git for workunit repo if we run upgrade test, where, for example, "jewel" is not in ceph-ci.git repo, we should check ceph.git to clone the workunits. Signed-off-by: Kefu Chai (cherry picked from commit edceabbd47697cb4e7d21798e57a58969a92ce79) --- diff --git a/qa/tasks/workunit.py b/qa/tasks/workunit.py index 2720363b4f98d..8ab9681c2c335 100644 --- a/qa/tasks/workunit.py +++ b/qa/tasks/workunit.py @@ -309,23 +309,53 @@ 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_qa_suite_git_url() - remote.run( - logger=log.getChild(role), - args=[ - 'rm', - '-rf', - clonedir, - run.Raw('&&'), - 'git', - 'clone', + # if we are running an upgrade test, and ceph-ci does not have branches like + # `jewel`, so should use ceph.git as an alternative. + try: + remote.run( + logger=log.getChild(role), + args=[ + 'rm', + '-rf', + clonedir, + run.Raw('&&'), + 'git', + 'clone', + git_url, + clonedir, + run.Raw('&&'), + 'cd', '--', clonedir, + run.Raw('&&'), + 'git', 'checkout', refspec, + ], + ) + except CommandFailedError: + if not git_url.endswith('/ceph-ci.git'): + raise + alt_git_url = git_url.replace('/ceph-ci.git', '/ceph.git') + 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=[ + 'rm', + '-rf', + clonedir, + run.Raw('&&'), + 'git', + 'clone', + alt_git_url, + clonedir, + run.Raw('&&'), + 'cd', '--', clonedir, + run.Raw('&&'), + 'git', 'checkout', refspec, + ], + ) remote.run( logger=log.getChild(role), args=[