]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Make teuthology-{suite,worker} share repo code
authorZack Cerza <zack.cerza@inktank.com>
Wed, 6 Aug 2014 21:52:41 +0000 (15:52 -0600)
committerZack Cerza <zack.cerza@inktank.com>
Thu, 7 Aug 2014 17:13:42 +0000 (11:13 -0600)
Repo-fetching code, that is.

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/repo_utils.py
teuthology/suite.py
teuthology/worker.py

index 5c3ee93c67c562fe78d24f102d75c1a5b4f08d74..47346083e20c396828e72c9f0b2ba96c6c80b645 100644 (file)
@@ -150,6 +150,8 @@ def fetch_qa_suite(branch, lock=True):
     :returns:      The destination path
     """
     src_base_path = config.src_base_path
+    if not os.path.exists(src_base_path):
+        os.mkdir(src_base_path)
     dest_path = os.path.join(src_base_path, 'ceph-qa-suite_' + branch)
     qa_suite_url = os.path.join(config.ceph_git_base_url, 'ceph-qa-suite')
     # only let one worker create/update the checkout at a time
@@ -159,14 +161,16 @@ def fetch_qa_suite(branch, lock=True):
     return dest_path
 
 
-def fetch_teuthology_branch(branch, lock=True):
+def fetch_teuthology(branch, lock=True):
     """
     Make sure we have the correct teuthology branch checked out and up-to-date
 
-    :param branch: The branche we want
+    :param branch: The branch we want
     :returns:      The destination path
     """
     src_base_path = config.src_base_path
+    if not os.path.exists(src_base_path):
+        os.mkdir(src_base_path)
     dest_path = os.path.join(src_base_path, 'teuthology_' + branch)
     # only let one worker create/update the checkout at a time
     lock_path = dest_path.rstrip('/') + '.lock'
index fe2bd241888b3b8e4d5b58c35a1589125d0ee9d2..5b531f240e82fcbd97e3f2dd7154a73641512238 100644 (file)
@@ -19,8 +19,8 @@ from tempfile import NamedTemporaryFile
 import teuthology
 from . import lock
 from .config import config, JobConfig
-from .repo_utils import enforce_repo_state
 from .exceptions import BranchNotFoundError
+from .repo_utils import fetch_qa_suite, fetch_teuthology
 
 log = logging.getLogger(__name__)
 
@@ -61,8 +61,7 @@ def main(args):
     if suite_dir:
         suite_repo_path = suite_dir
     else:
-        suite_repo_path = fetch_suite_repo(job_config.suite_branch,
-                                           test_name=name)
+        suite_repo_path = fetch_repos(job_config.suite_branch, test_name=name)
 
     job_config.name = name
     job_config.priority = priority
@@ -107,7 +106,7 @@ def make_run_name(suite, ceph_branch, kernel_branch, kernel_flavor,
     )
 
 
-def fetch_suite_repo(branch, test_name):
+def fetch_repos(branch, test_name):
     """
     Fetch the suite repo (and also the teuthology repo) so that we can use it
     to build jobs. Repos are stored in ~/src/.
@@ -118,30 +117,15 @@ def fetch_suite_repo(branch, test_name):
     for test scheduling, regardless of what teuthology branch is requested for
     testing.
 
-    :returns: The path to the repo on disk
+    :returns: The path to the suite repo on disk
     """
-    src_base_path = config.src_base_path
-    if not os.path.exists(src_base_path):
-        os.mkdir(src_base_path)
-    suite_repo_path = os.path.join(src_base_path,
-                                   'ceph-qa-suite_' + branch)
     try:
         # When a user is scheduling a test run from their own copy of
         # teuthology, let's not wreak havoc on it.
         if config.automated_scheduling:
-            enforce_repo_state(
-                repo_url=os.path.join(config.ceph_git_base_url,
-                                      'teuthology.git'),
-                dest_path=os.path.join(src_base_path, 'teuthology'),
-                branch='master',
-                remove_on_error=False,
-            )
-        enforce_repo_state(
-            repo_url=os.path.join(config.ceph_git_base_url,
-                                  'ceph-qa-suite.git'),
-            dest_path=suite_repo_path,
-            branch=branch,
-        )
+            # We use teuthology's master branch in all cases right now
+            fetch_teuthology('master')
+        suite_repo_path = fetch_qa_suite(branch)
     except BranchNotFoundError as exc:
         schedule_fail(message=str(exc), name=test_name)
     return suite_repo_path
index 01efab371f5eead0065a3934617365c491bf8e7e..31faacdd817b510ca2157ab66c81f8f0b3abbd3e 100644 (file)
@@ -16,7 +16,7 @@ from .config import config as teuth_config
 from .exceptions import BranchNotFoundError
 from .kill import kill_job
 from .misc import read_config
-from .repo_utils import fetch_qa_suite, fetch_teuthology_branch
+from .repo_utils import fetch_qa_suite, fetch_teuthology
 
 log = logging.getLogger(__name__)
 start_time = datetime.utcnow()
@@ -113,7 +113,7 @@ def main(ctx):
         job_config['teuthology_branch'] = teuthology_branch
 
         try:
-            teuth_path = fetch_teuthology_branch(branch=teuthology_branch)
+            teuth_path = fetch_teuthology(branch=teuthology_branch)
             # For the teuthology tasks, we look for suite_branch, and if we
             # don't get that, we look for branch, and fall back to 'master'.
             # last-in-suite jobs don't have suite_branch or branch set.