From b9fe754c968adb341602f7e3bf8ac36b267f74b8 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 15 Dec 2016 12:33:45 -0700 Subject: [PATCH] ShamanProject._tag_to_sha1(): retry w/ ceph.git For upgrade tests that are otherwise using ceph-ci.git, we need to also look in ceph.git to lookup released tags. Signed-off-by: Zack Cerza --- teuthology/packaging.py | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/teuthology/packaging.py b/teuthology/packaging.py index 7785067fe..6b5c15d6a 100644 --- a/teuthology/packaging.py +++ b/teuthology/packaging.py @@ -889,17 +889,35 @@ class ShamanProject(GitbuilderProject): """ Shaman doesn't know about tags. Use git ls-remote to query the remote repo in order to map tags to their sha1 value. + + This method will also retry against ceph.git if the original request + uses ceph-ci.git and fails. """ + def get_sha1(url): + # Ceph (and other projects) uses annotated tags for releases. This + # has the side-effect of making git ls-remote return the sha1 for + # the annotated tag object and not the last "real" commit in that + # tag. By contrast, when a person (or a build system) issues a + # "git checkout " command, HEAD will be the last "real" commit + # and not the tag. + # Below we have to append "^{}" to the tag value to work around + # this in order to query for the sha1 that the build system uses. + return repo_utils.ls_remote(url, "%s^{}" % self.tag) + git_url = repo_utils.build_git_url(self.project) - # Ceph (and other projects) uses annotated tags for releases. This has - # the side-effect of making git ls-remote return the sha1 for the - # annotated tag object and not the last "real" commit in that tag. By - # contrast, when a person (or a build system) issues a - # "git checkout " command, HEAD will be the last "real" commit and - # not the tag. - # Below we have to append "^{}" to the tag value to work around this in - # order to query for the sha1 that the build system uses. - result = repo_utils.ls_remote(git_url, "%s^{}" % self.tag) + result = get_sha1(git_url) + # For upgrade tests that are otherwise using ceph-ci.git, we need to + # also look in ceph.git to lookup released tags. + if result is None and 'ceph-ci' in git_url: + alt_git_url = git_url.replace('ceph-ci', 'ceph') + log.info( + "Tag '%s' not found in %s; will also look in %s", + self.tag, + git_url, + alt_git_url, + ) + result = get_sha1(alt_git_url) + if result is None: raise CommitNotFoundError(self.tag, git_url) return result -- 2.47.3