]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/workunit: use ceph.git as an alternative of ceph-ci.git for workunit repo
authorKefu Chai <kchai@redhat.com>
Mon, 27 Feb 2017 08:29:40 +0000 (16:29 +0800)
committerZack Cerza <zack@redhat.com>
Wed, 12 Apr 2017 16:21:01 +0000 (10:21 -0600)
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 <kchai@redhat.com>
(cherry picked from commit edceabbd47697cb4e7d21798e57a58969a92ce79)

qa/tasks/workunit.py

index 2720363b4f98d0ba0797190ff0c2c95599547ae7..8ab9681c2c335ba1ebc4c5bcd036b45455402145 100644 (file)
@@ -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=[