From: Zack Cerza Date: Thu, 15 Dec 2016 19:33:45 +0000 (-0700) Subject: ShamanProject._tag_to_sha1(): retry w/ ceph.git X-Git-Tag: 1.1.0~480^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1000%2Fhead;p=teuthology.git 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 --- diff --git a/teuthology/packaging.py b/teuthology/packaging.py index 7785067f..6b5c15d6 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