]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
workunit: fetch from --ceph-git-url
authorLoic Dachary <ldachary@redhat.com>
Sun, 6 Dec 2015 12:08:20 +0000 (13:08 +0100)
committerLoic Dachary <ldachary@redhat.com>
Sun, 6 Dec 2015 12:23:14 +0000 (13:23 +0100)
The commit from which workunits are fetched must be retrieved
from --ceph-git-url via teuth_config.get_ceph_git_url() instead of
assuming it is available via git://git.ceph.com/ceph.git.

Using git://git.ceph.com/ceph.git is convenient because it supports git
archive. In the general case, some git servers such as github do not
support git archive and a full git clone must be done instead.

Although it would be possible to

    git clone --branch=master --depth=1 --single-branch

to reduce the amount of data being retrieved, it would require a

    git fetch origin SHA1

but git version >= 1.7 do not support fetching a commit.

http://tracker.ceph.com/issues/13624 Fixes: #13624

Signed-off-by: Loic Dachary <loic@dachary.org>
suites/teuthology/workunits/yes.yaml [new file with mode: 0644]
tasks/workunit.py

diff --git a/suites/teuthology/workunits/yes.yaml b/suites/teuthology/workunits/yes.yaml
new file mode 100644 (file)
index 0000000..45098db
--- /dev/null
@@ -0,0 +1,8 @@
+roles:
+    - [client.0]
+tasks:
+- install:
+- workunit:
+    clients:
+      all:
+        - true.sh
index a2010b34a832fb1f550ba567f26a37dc7633e38f..3c102660be37d1106cc0b5b21c9602d78d90b505 100644 (file)
@@ -6,6 +6,7 @@ import pipes
 import os
 
 from teuthology import misc
+from teuthology.config import config as teuth_config
 from teuthology.orchestra.run import CommandFailedError
 from teuthology.parallel import parallel
 from teuthology.orchestra import run
@@ -287,22 +288,46 @@ def _run_tests(ctx, refspec, role, tests, env, subdir=None, timeout=None):
     else:
         scratch_tmp = os.path.join(mnt, subdir)
     srcdir = '{tdir}/workunit.{role}'.format(tdir=testdir, role=role)
+    clonedir = '{tdir}/clone'.format(tdir=testdir)
+
+    git_url = teuth_config.get_ceph_git_url()
+    if 'github.com/ceph/ceph' in git_url:
+        remote.run(
+            logger=log.getChild(role),
+            args=[
+                'mkdir', '--', srcdir,
+                run.Raw('&&'),
+                'git',
+                'archive',
+                '--remote=git://git.ceph.com/ceph.git',
+                '%s:qa/workunits' % refspec,
+                run.Raw('|'),
+                'tar',
+                '-C', srcdir,
+                '-x',
+                '-f-',
+            ],
+        )
+    else:
+        remote.run(
+            logger=log.getChild(role),
+            args=[
+                'git',
+                'clone',
+                git_url,
+                clonedir,
+                run.Raw(';'),
+                'cd', '--', clonedir,
+                run.Raw('&&'),
+                'git', 'reset', '--hard', refspec,
+                run.Raw('&&'),
+                'mv', 'qa/workunits', srcdir,
+            ],
+        )
 
     remote.run(
         logger=log.getChild(role),
         args=[
-            'mkdir', '--', srcdir,
-            run.Raw('&&'),
-            'git',
-            'archive',
-            '--remote=git://git.ceph.com/ceph.git',
-            '%s:qa/workunits' % refspec,
-            run.Raw('|'),
-            'tar',
-            '-C', srcdir,
-            '-x',
-            '-f-',
-            run.Raw('&&'),
             'cd', '--', srcdir,
             run.Raw('&&'),
             'if', 'test', '-e', 'Makefile', run.Raw(';'), 'then', 'make', run.Raw(';'), 'fi',
@@ -368,6 +393,6 @@ def _run_tests(ctx, refspec, role, tests, env, subdir=None, timeout=None):
         remote.run(
             logger=log.getChild(role),
             args=[
-                'rm', '-rf', '--', workunits_file, srcdir,
+                'rm', '-rf', '--', workunits_file, srcdir, clonedir,
             ],
         )