From: Vallari Agrawal Date: Tue, 1 Jul 2025 14:10:01 +0000 (+0530) Subject: suite/run.py: update sha1 from basic_config to parsed_yaml X-Git-Tag: 1.2.2~18^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=223258aac238b9e53c8e5a3749d905e647d84a06;p=teuthology.git suite/run.py: update sha1 from basic_config to parsed_yaml This is because during backtracking to find build when using --newest, the new build/suite sha is updated on basic_config. And job's parsed_yaml is never updated with new sha. Fixes: https://tracker.ceph.com/issues/71612 Signed-off-by: Vallari Agrawal --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 93bdc7a4d..d4c619cc5 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -1009,6 +1009,17 @@ def deep_merge(a: DeepMerge, b: DeepMerge) -> DeepMerge: return a return b +def update_key(key_to_update, a: dict, b: dict): + """ + Update key (`key_to_update`) of dict `a` on all levels + to the values of same key in `b` dict. + """ + for key, value in b.items(): + if key == key_to_update: + a[key] = value + elif isinstance(value, dict): + if key in a and isinstance(a[key], dict): + update_key(key_to_update, a[key], value) def ssh_keyscan(hostnames, _raise=True): """ diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index 8115c4122..0f76fb746 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -15,7 +15,7 @@ from teuthology.config import config, JobConfig from teuthology.exceptions import ( BranchMismatchError, BranchNotFoundError, CommitNotFoundError, ) -from teuthology.misc import deep_merge, get_results_url +from teuthology.misc import deep_merge, get_results_url, update_key from teuthology.orchestra.opsys import OS from teuthology.repo_utils import build_git_url @@ -506,6 +506,8 @@ class Run(object): log.info('Skipping due to excluded_os_type: %s facets %s', exclude_os_type, description) continue + update_key('sha1', parsed_yaml, self.base_config) + update_key('suite_sha1', parsed_yaml, self.base_config) arg = copy.deepcopy(self.base_args) arg.extend([