From 6c7f93b5756722918db465a14eebcedce3c8f711 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Sat, 16 Jan 2021 21:16:59 -0500 Subject: [PATCH] suite: pass the commit of teuthology with each job's config We already pass the suite sha1, but do not use it yet. This is the missing piece to be able to use the same version of everything across a whole run. Signed-off-by: Josh Durgin --- teuthology/suite/placeholder.py | 1 + teuthology/suite/run.py | 17 ++++++++++------- teuthology/suite/test/test_placeholder.py | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/teuthology/suite/placeholder.py b/teuthology/suite/placeholder.py index 1e5014d0ae..2bfd07df85 100644 --- a/teuthology/suite/placeholder.py +++ b/teuthology/suite/placeholder.py @@ -47,6 +47,7 @@ dict_templ = { 'branch': Placeholder('ceph_branch'), 'sha1': Placeholder('ceph_hash'), 'teuthology_branch': Placeholder('teuthology_branch'), + 'teuthology_sha1': Placeholder('teuthology_sha1'), 'archive_upload': Placeholder('archive_upload'), 'archive_upload_key': Placeholder('archive_upload_key'), 'machine_type': Placeholder('machine_type'), diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index 3b64185ee9..4b43d0180a 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -99,7 +99,7 @@ class Run(object): else: self.suite_repo_path = util.fetch_repos( suite_branch, test_name=self.name) - teuthology_branch = self.choose_teuthology_branch() + teuthology_branch, teuthology_sha1 = self.choose_teuthology_branch() if self.args.distro_version: @@ -113,6 +113,7 @@ class Run(object): ceph_hash=ceph_hash, ceph_repo=config.get_ceph_git_url(), teuthology_branch=teuthology_branch, + teuthology_sha1=teuthology_sha1, machine_type=self.args.machine_type, distro=self.args.distro, distro_version=self.args.distro_version, @@ -200,8 +201,9 @@ class Run(object): log.info('skipping ceph package verification') def choose_teuthology_branch(self): - """Select teuthology branch, check if it is present in repo and - return the branch name value. + """Select teuthology branch, check if it is present in repo and return + tuple (branch, hash) where hash is commit sha1 corresponding + to the HEAD of the branch. The branch name value is determined in the following order: @@ -220,6 +222,7 @@ class Run(object): Use ``master``. Generate exception if the branch is not present in the repo. + """ teuthology_branch = self.args.teuthology_branch if not teuthology_branch: @@ -242,15 +245,15 @@ class Run(object): if not teuthology_branch: teuthology_branch = config.get('teuthology_branch', 'master') - teuthology_hash = util.git_ls_remote( + teuthology_sha1 = util.git_ls_remote( 'teuthology', teuthology_branch ) - if not teuthology_hash: + if not teuthology_sha1: exc = BranchNotFoundError(teuthology_branch, build_git_url('teuthology')) util.schedule_fail(message=str(exc), name=self.name) - log.info("teuthology branch: %s %s", teuthology_branch, teuthology_hash) - return teuthology_branch + log.info("teuthology branch: %s %s", teuthology_branch, teuthology_sha1) + return teuthology_branch, teuthology_sha1 @property def ceph_repo_name(self): diff --git a/teuthology/suite/test/test_placeholder.py b/teuthology/suite/test/test_placeholder.py index 4b2c2fb75a..3427439fd3 100644 --- a/teuthology/suite/test/test_placeholder.py +++ b/teuthology/suite/test/test_placeholder.py @@ -13,6 +13,7 @@ class TestPlaceholder(object): ceph_branch='ceph_branch', ceph_hash='ceph_hash', teuthology_branch='teuthology_branch', + teuthology_sha1='teuthology_sha1', machine_type='machine_type', distro='distro', distro_version='distro_version', @@ -38,6 +39,7 @@ class TestPlaceholder(object): ceph_branch='ceph_branch', ceph_hash='ceph_hash', teuthology_branch='teuthology_branch', + teuthology_sha1='teuthology_sha1', machine_type='machine_type', archive_upload='archive_upload', archive_upload_key='archive_upload_key', -- 2.39.5