Bug 1455258 - staging release-runner must check partials in staging bucket r=rail THUNDERBIRD_60_0b5_BUILD1 THUNDERBIRD_60_0b5_RELEASE
authorJohan Lorenzo <jlorenzo@mozilla.com>
Thu, 19 Apr 2018 12:09:26 +0200
changeset 8382 15b75103b84b
parent 8381 4857af2c3137
child 8383 5d35a424bc33
push id6119
push userraliiev@mozilla.com
push dateTue, 24 Apr 2018 02:18:31 +0000
reviewersrail
bugs1455258
Bug 1455258 - staging release-runner must check partials in staging bucket r=rail MozReview-Commit-ID: 4Qg6Aofd07j
lib/python/kickoff/sanity/partials.py
--- a/lib/python/kickoff/sanity/partials.py
+++ b/lib/python/kickoff/sanity/partials.py
@@ -4,19 +4,16 @@ import requests
 
 from kickoff.sanity.base import ReleaseSanitizerTestSuite, ReleaseSanitizerRunner, make_generic_get_request, \
                                 is_candidate_release
 from kickoff import matches
 
 log = logging.getLogger(__name__)
 
 
-CANDIDATES_SHA512_URL_TEMPLATE = "https://archive.mozilla.org/pub/{product}/candidates/" \
-                                 "{version}-candidates/build{build_number}/SHA512SUMS"
-RELEASES_SHA512_URL_TEMPLATE = "https://archive.mozilla.org/pub/{product}/releases/{version}/SHA512SUMS"
 BETA_PATTERNS = [r"\d+\.0b\d+"]
 
 
 class PartialsTestSuite(ReleaseSanitizerTestSuite):
     def __init__(self, **kwargs):
         ReleaseSanitizerTestSuite.__init__(self, **kwargs)
         self.partial_updates = self.kwargs['partial_updates']
 
@@ -64,23 +61,25 @@ class PartialsTestSuite(ReleaseSanitizer
                 result.add_error(err_msg, sys.exc_info())
 
             return sha_sum
 
         for pversion, info in self.kwargs["partial_updates"].iteritems():
             buildno = info["buildNumber"]
 
             # make sure partial is valid and shipped correctly to /candidates
-            _url = CANDIDATES_SHA512_URL_TEMPLATE.format(
-                product=self.kwargs["product"], version=pversion, build_number=buildno)
+            candidates_template = get_url_template(self.branch, 'candidates')
+            _url = candidates_template.format(
+                product=self.kwargs["product"], version=pversion, build_number=buildno
+            )
             candidate_sha = grab_partial_sha(_url)
 
             # make sure partial has a shipped release under /releases
-            _url = RELEASES_SHA512_URL_TEMPLATE.format(
-                product=self.kwargs["product"], version=pversion)
+            releases_template = get_url_template(self.branch, 'releases')
+            _url = releases_template.format(product=self.kwargs["product"], version=pversion)
             releases_sha = grab_partial_sha(_url)
 
             err_msg = ("{version}-build{build_number} is a good candidate"
                        " build, but not the one we shipped! URL: {url}").format(
                            version=pversion,
                            build_number=buildno,
                            url=_url)
             self.assertEqual(result, releases_sha, candidate_sha, err_msg)
@@ -106,8 +105,24 @@ class PartialsTestSuite(ReleaseSanitizer
 
         err_msg = ("All partials in the RC list are betas. At least a non-beta"
                    " release is needed in {l}").format(l=partials)
         self.assertEqual(result, all_betas, False, err_msg)
 
 
 class PartialsSanitizer(ReleaseSanitizerRunner):
     testSuite = PartialsTestSuite
+
+
+def get_url_template(branch, candidates_or_releases):
+    if branch in ('mozilla-beta', 'mozilla-release') or 'mozilla-esr' in branch:
+        domain_name = 'archive.mozilla.org'
+    else:
+        domain_name = 'bucketlister-delivery.stage.mozaws.net'
+
+    if candidates_or_releases == 'releases':
+        path = 'pub/{product}/releases/{version}/SHA512SUMS'
+    elif candidates_or_releases == 'candidates':
+        path = 'pub/{product}/candidates/{version}-candidates/build{build_number}/SHA512SUMS'
+    else:
+        raise Exception('Unsupported "candidates_or_releases": "{}"'.format(candidates_or_releases))
+
+    return 'https://{}/{}'.format(domain_name, path)