]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
ShamanProject._tag_to_sha1(): retry w/ ceph.git 1000/head
authorZack Cerza <zack@redhat.com>
Thu, 15 Dec 2016 19:33:45 +0000 (12:33 -0700)
committerZack Cerza <zack@redhat.com>
Thu, 15 Dec 2016 19:49:38 +0000 (12:49 -0700)
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 <zack@redhat.com>
teuthology/packaging.py

index 7785067fe8e770e93236581193536ac13ba0298f..6b5c15d6a5177397772eb9fa94f0416cb68821d1 100644 (file)
@@ -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 <tag>" 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 <tag>" 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