From: Zack Cerza Date: Tue, 13 Dec 2016 17:03:46 +0000 (-0700) Subject: suite: Add --ceph-repo option X-Git-Tag: 1.1.0~484^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eda3ab48808013ad04a3097e502014a6da64a853;p=teuthology.git suite: Add --ceph-repo option Signed-off-by: Zack Cerza --- diff --git a/scripts/suite.py b/scripts/suite.py index beabcc36d..205ae3657 100644 --- a/scripts/suite.py +++ b/scripts/suite.py @@ -57,6 +57,8 @@ Standard arguments: Distribution to run against -D , --distro-version Distro version to run against + --ceph-repo Query this repository for Ceph branch and SHA1 + values [default: {default_ceph_repo}] --suite-repo Use tasks and suite definition in this repository [default: {default_suite_repo}] --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(), ) diff --git a/teuthology/suite/placeholder.py b/teuthology/suite/placeholder.py index de346e4f5..06723a9f4 100644 --- a/teuthology/suite/placeholder.py +++ b/teuthology/suite/placeholder.py @@ -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'), diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index c09e89f01..ac8fea400 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -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' diff --git a/teuthology/suite/test/test_placeholder.py b/teuthology/suite/test/test_placeholder.py index 297b44c27..4b2c2fb75 100644 --- a/teuthology/suite/test/test_placeholder.py +++ b/teuthology/suite/test/test_placeholder.py @@ -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