Distribution to run against
-D <distroversion>, --distro-version <distroversion>
Distro version to run against
+ --suite-repo <suite_repo> Use tasks and suite definition in this repository
+ [default: {default_suite_repo}]
--suite-branch <suite_branch>
Use this suite branch instead of the ceph branch
--suite-dir <suite_dir> Use this alternative directory as-is when
'fail', 'pass', 'queued', 'running', 'waiting'
[default: fail,dead]
-""".format(default_machine_type=config.default_machine_type,
- default_results_timeout=config.results_timeout)
+""".format(
+ default_machine_type=config.default_machine_type,
+ default_results_timeout=config.results_timeout,
+ default_suite_repo=config.get_ceph_qa_suite_git_url(),
+)
def main(argv=sys.argv[1:]):
}
},
'suite': Placeholder('suite'),
+ 'suite_repo': Placeholder('suite_repo'),
'suite_branch': Placeholder('suite_branch'),
'suite_sha1': Placeholder('suite_hash'),
'tasks': [],
"""
self.args = args
self.name = self.make_run_name()
+
+ if self.args.suite_repo:
+ config.ceph_qa_suite_git_url = self.args.suite_repo
+
self.base_config = self.create_initial_config()
# caches package versions to minimize requests to gbs
self.package_versions = dict()
distro_version=self.args.distro_version,
archive_upload=config.archive_upload,
archive_upload_key=config.archive_upload_key,
+ suite_repo=config.get_ceph_qa_suite_git_url(),
)
return self.build_base_config()
log.info("teuthology branch: %s", teuthology_branch)
return teuthology_branch
+ @property
+ def suite_repo_name(self):
+ if self.args.suite_repo:
+ return self.args.suite_repo.split('/')[-1].rstrip('.git')
+ else:
+ return 'ceph-qa-suite'
+
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'
suite_branch = self.args.suite_branch
ceph_branch = self.args.ceph_branch
if suite_branch and suite_branch != 'master':
- if not util.git_branch_exists('ceph-qa-suite', suite_branch):
- exc = BranchNotFoundError(suite_branch, 'ceph-qa-suite.git')
+ if not util.git_branch_exists(
+ suite_repo_project_or_url,
+ suite_branch
+ ):
+ exc = BranchNotFoundError(suite_branch, suite_repo_name)
util.schedule_fail(message=str(exc), name=self.name)
elif not suite_branch:
- # Decide what branch of ceph-qa-suite to use
- if util.git_branch_exists('ceph-qa-suite', ceph_branch):
+ # Decide what branch of the suite repo to use
+ if util.git_branch_exists(suite_repo_project_or_url, ceph_branch):
suite_branch = ceph_branch
else:
log.info(
- "branch {0} not in ceph-qa-suite.git; will use master for"
- " ceph-qa-suite".format(ceph_branch))
+ "branch {0} not in {1}; will use master for"
+ " ceph-qa-suite".format(
+ ceph_branch,
+ suite_repo_name
+ ))
suite_branch = 'master'
return suite_branch
def choose_suite_hash(self, suite_branch):
- suite_hash = util.git_ls_remote('ceph-qa-suite', suite_branch)
+ suite_repo_name = self.suite_repo_name
+ suite_repo_project_or_url = self.args.suite_repo or 'ceph-qa-suite'
+ suite_hash = util.git_ls_remote(
+ suite_repo_project_or_url,
+ suite_branch
+ )
if not suite_hash:
- exc = BranchNotFoundError(suite_branch, 'ceph-qa-suite.git')
+ exc = BranchNotFoundError(suite_branch, suite_repo_name)
util.schedule_fail(message=str(exc), name=self.name)
- log.info("ceph-qa-suite branch: %s %s", suite_branch, suite_hash)
+ log.info("%s branch: %s %s", suite_repo_name, suite_branch, suite_hash)
return suite_hash
def build_base_config(self):
distro_version='distro_version',
archive_upload='archive_upload',
archive_upload_key='archive_upload_key',
+ suite_repo='https://example.com/ceph/suite.git',
)
output_dict = substitute_placeholders(dict_templ, input_dict)
assert output_dict['suite'] == 'suite'
archive_upload_key='archive_upload_key',
distro=None,
distro_version=None,
+ suite_repo='https://example.com/ceph/suite.git',
)
output_dict = substitute_placeholders(dict_templ, input_dict)
assert 'os_type' not in output_dict
from teuthology.suite import util
+REPO_PROJECTS_AND_URLS = [
+ 'ceph',
+ 'https://github.com/not_ceph/ceph.git',
+]
+
+
+@pytest.mark.parametrize('project_or_url', REPO_PROJECTS_AND_URLS)
@patch('subprocess.check_output')
-def test_git_branch_exists(m_check_output):
+def test_git_branch_exists(m_check_output, project_or_url):
m_check_output.return_value = ''
- assert False == util.git_branch_exists('ceph', 'nobranchnowaycanthappen')
+ assert False == util.git_branch_exists(
+ project_or_url, 'nobranchnowaycanthappen')
m_check_output.return_value = 'HHH branch'
- assert True == util.git_branch_exists('ceph', 'master')
+ assert True == util.git_branch_exists(project_or_url, 'master')
@pytest.fixture
)
-def git_ls_remote(project, branch, project_owner='ceph'):
+def git_ls_remote(project_or_url, branch, project_owner='ceph'):
"""
Find the latest sha1 for a given project's branch.
+ :param project_or_url: Either a project name or a full URL
+ :param branch: The branch to query
+ :param project_owner: The GitHub project owner. Only used when a project
+ name is passed; not when a URL is passed
:returns: The sha1 if found; else None
"""
- url = build_git_url(project, project_owner)
+ if '://' in project_or_url:
+ url = project_or_url
+ else:
+ url = build_git_url(project_or_url, project_owner)
return repo_utils.ls_remote(url, branch)
return None
-def git_branch_exists(project, branch, project_owner='ceph'):
+def git_branch_exists(project_or_url, branch, project_owner='ceph'):
"""
Query the git repository to check the existence of a project's branch
+
+ :param project_or_url: Either a project name or a full URL
+ :param branch: The branch to query
+ :param project_owner: The GitHub project owner. Only used when a project
+ name is passed; not when a URL is passed
"""
- return git_ls_remote(project, branch, project_owner) is not None
+ return git_ls_remote(project_or_url, branch, project_owner) is not None
def get_branch_info(project, branch, project_owner='ceph'):