]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
suite: Add --ceph-repo option
authorZack Cerza <zack@redhat.com>
Tue, 13 Dec 2016 17:03:46 +0000 (10:03 -0700)
committerZack Cerza <zack@redhat.com>
Tue, 13 Dec 2016 17:03:46 +0000 (10:03 -0700)
Signed-off-by: Zack Cerza <zack@redhat.com>
scripts/suite.py
teuthology/suite/placeholder.py
teuthology/suite/run.py
teuthology/suite/test/test_placeholder.py

index beabcc36d00a2130bd7e1de6657ad6bd90204e12..205ae36574fcb7e3fe7a85b5449bb0e96ef14172 100644 (file)
@@ -57,6 +57,8 @@ Standard arguments:
                               Distribution to run against
   -D <distroversion>, --distro-version <distroversion>
                               Distro version to run against
+  --ceph-repo <ceph_repo>     Query this repository for Ceph branch and SHA1
+                              values [default: {default_ceph_repo}]
   --suite-repo <suite_repo>   Use tasks and suite definition in this repository
                               [default: {default_suite_repo}]
   --suite-relpath <suite_relpath>
@@ -125,6 +127,7 @@ Scheduler arguments:
 """.format(
     default_machine_type=config.default_machine_type,
     default_results_timeout=config.results_timeout,
+    default_ceph_repo=config.get_ceph_git_url(),
     default_suite_repo=config.get_ceph_qa_suite_git_url(),
 )
 
index de346e4f55f386dabbf8e28c146192072a03e104..06723a9f403e70983a75c0f5f3c054d182b70e0d 100644 (file)
@@ -95,6 +95,7 @@ dict_templ = {
             'sha1': Placeholder('ceph_hash'),
         }
     },
+    'repo': Placeholder('ceph_repo'),
     'suite': Placeholder('suite'),
     'suite_repo': Placeholder('suite_repo'),
     'suite_relpath': Placeholder('suite_relpath'),
index c09e89f019b428c10fe6b406a7391df673586696..ac8fea4005fe6450c04a9d6b8063ad5b5076a8c2 100644 (file)
@@ -2,6 +2,7 @@ import copy
 import logging
 import os
 import pwd
+import re
 import time
 import yaml
 
@@ -37,6 +38,8 @@ class Run(object):
         self.args = args
         self.name = self.make_run_name()
 
+        if self.args.ceph_repo:
+            config.ceph_git_url = self.args.ceph_repo
         if self.args.suite_repo:
             config.ceph_qa_suite_git_url = self.args.suite_repo
 
@@ -100,6 +103,7 @@ class Run(object):
             suite_hash=suite_hash,
             ceph_branch=self.args.ceph_branch,
             ceph_hash=ceph_hash,
+            ceph_repo=config.get_ceph_git_url(),
             teuthology_branch=teuthology_branch,
             machine_type=self.args.machine_type,
             distro=self.args.distro,
@@ -144,18 +148,25 @@ class Run(object):
         just keep the ceph_branch around.  Otherwise use the current git branch
         tip.
         """
+        repo_name = self.ceph_repo_name
 
         if self.args.ceph_sha1:
-            ceph_hash = util.git_validate_sha1('ceph', self.args.ceph_sha1)
+            ceph_hash = util.git_validate_sha1(repo_name, self.args.ceph_sha1)
             if not ceph_hash:
-                exc = CommitNotFoundError(self.args.ceph_sha1, 'ceph.git')
+                exc = CommitNotFoundError(
+                    self.args.ceph_sha1,
+                    '%s.git' % repo_name
+                )
                 util.schedule_fail(message=str(exc), name=self.name)
             log.info("ceph sha1 explicitly supplied")
 
         elif self.args.ceph_branch:
-            ceph_hash = util.git_ls_remote('ceph', self.args.ceph_branch)
+            ceph_hash = util.git_ls_remote(repo_name, self.args.ceph_branch)
             if not ceph_hash:
-                exc = BranchNotFoundError(self.args.ceph_branch, 'ceph.git')
+                exc = BranchNotFoundError(
+                    self.args.ceph_branch,
+                    '%s.git' % repo_name
+                )
                 util.schedule_fail(message=str(exc), name=self.name)
 
         log.info("ceph sha1: {hash}".format(hash=ceph_hash))
@@ -195,13 +206,24 @@ class Run(object):
         log.info("teuthology branch: %s", teuthology_branch)
         return teuthology_branch
 
+    @property
+    def ceph_repo_name(self):
+        if self.args.ceph_repo:
+            return self._repo_name(self.args.ceph_repo)
+        else:
+            return 'ceph'
+
     @property
     def suite_repo_name(self):
         if self.args.suite_repo:
-            return self.args.suite_repo.split('/')[-1].rstrip('.git')
+            return self._repo_name(self.args.suite_repo)
         else:
             return 'ceph-qa-suite'
 
+    @staticmethod
+    def _repo_name(url):
+        return re.sub('\.git$', '', url.split('/')[-1])
+
     def choose_suite_branch(self):
         suite_repo_name = self.suite_repo_name
         suite_repo_project_or_url = self.args.suite_repo or 'ceph-qa-suite'
index 297b44c27f90a7d02da592864f63b1ef6144e8df..4b2c2fb75acecf9f8cad0c932631a528645573a8 100644 (file)
@@ -20,6 +20,7 @@ class TestPlaceholder(object):
             archive_upload_key='archive_upload_key',
             suite_repo='https://example.com/ceph/suite.git',
             suite_relpath='',
+            ceph_repo='https://example.com/ceph/ceph.git',
         )
         output_dict = substitute_placeholders(dict_templ, input_dict)
         assert output_dict['suite'] == 'suite'
@@ -44,6 +45,7 @@ class TestPlaceholder(object):
             distro_version=None,
             suite_repo='https://example.com/ceph/suite.git',
             suite_relpath='',
+            ceph_repo='https://example.com/ceph/ceph.git',
         )
         output_dict = substitute_placeholders(dict_templ, input_dict)
         assert 'os_type' not in output_dict