Bug 1469803 Update cron bouncer check to use product-details r=rail
authorSimon Fraser <sfraser@mozilla.com>
Fri, 29 Jun 2018 18:41:42 +0000
changeset 424619 068e65e94cff6cc81fb86f7ed39e178fcd4eb7c1
parent 424618 e0c1a76aca4f77227d35e2d53faa587de279fb6e
child 424620 d73fc7a2cf1dce9d3a5e00133247ff2cadcdc811
push id34220
push usertoros@mozilla.com
push dateMon, 02 Jul 2018 21:52:37 +0000
treeherdermozilla-central@959983b7d19e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrail
bugs1469803
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1469803 Update cron bouncer check to use product-details r=rail Differential Revision: https://phabricator.services.mozilla.com/D1883
.cron.yml
taskcluster/ci/bouncer-check/kind.yml
taskcluster/taskgraph/transforms/bouncer_check.py
testing/mozharness/scripts/release/bouncer_check.py
--- a/.cron.yml
+++ b/.cron.yml
@@ -105,29 +105,25 @@ jobs:
     - name: bouncer-check
       job:
           type: decision-task
           treeherder-symbol: Rel
           target-tasks-method: bouncer_check
       run-on-projects:
           - mozilla-beta
           - mozilla-release
-          - mozilla-esr60
       when:
           by-project:
               # No default branch
               mozilla-beta:
                   - {hour: 7, minute: 0}
                   - {hour: 19, minute: 0}
               mozilla-release:
                   - {hour: 7, minute: 0}
                   - {hour: 19, minute: 0}
-              mozilla-esr60:
-                  - {hour: 7, minute: 0}
-                  - {hour: 19, minute: 0}
 
     - name: periodic-update
       job:
           type: decision-task
           treeherder-symbol: Nfile
           target-tasks-method: file_update
       run-on-projects:
           - mozilla-central
--- a/taskcluster/ci/bouncer-check/kind.yml
+++ b/taskcluster/ci/bouncer-check/kind.yml
@@ -37,31 +37,38 @@ jobs:
             job-name: firefox-bouncer-check
         run:
             config:
                 by-project:
                     mozilla-beta:
                         - releases/bouncer_firefox_beta.py
                     mozilla-release:
                         - releases/bouncer_firefox_release.py
-                    mozilla-esr60:
-                        - releases/bouncer_firefox_esr.py
-                    jamun:
-                        - releases/dev_bouncer_firefox_esr.py
                     default:
                         - releases/dev_bouncer_firefox_beta.py
+            product-field:
+                by-project:
+                    mozilla-beta: LATEST_FIREFOX_RELEASED_DEVEL_VERSION
+                    mozilla-release: LATEST_FIREFOX_VERSION
+                    default: LATEST_FIREFOX_DEVEL_VERSION
+            products-url: https://product-details.mozilla.org/1.0/firefox_versions.json
         treeherder:
             platform: firefox-release/opt
 
     devedition:
         shipping-product: devedition
         index:
             product: devedition
             job-name: devedition-bouncer-check
         run:
             config:
                 by-project:
                     mozilla-beta:
                         - releases/bouncer_firefox_devedition.py
                     default:
                         - releases/dev_bouncer_firefox_devedition.py
+            product-field:
+                by-project:
+                    mozilla-beta: LATEST_FIREFOX_RELEASED_DEVEL_VERSION
+                    default: LATEST_FIREFOX_DEVEL_VERSION
+            products-url: https://product-details.mozilla.org/1.0/firefox_versions.json
         treeherder:
             platform: devedition-release/opt
--- a/taskcluster/taskgraph/transforms/bouncer_check.py
+++ b/taskcluster/taskgraph/transforms/bouncer_check.py
@@ -16,25 +16,22 @@ from taskgraph.util.schema import (
 import logging
 logger = logging.getLogger(__name__)
 
 transforms = TransformSequence()
 
 
 @transforms.add
 def add_command(config, jobs):
-    release_config = get_release_config(config)
-    version = release_config["version"]
     for job in jobs:
         job = copy.deepcopy(job)  # don't overwrite dict values here
         command = [
             "cd", "/builds/worker/checkouts/gecko", "&&",
             "./mach", "python",
             "testing/mozharness/scripts/release/bouncer_check.py",
-            "--version={}".format(version),
         ]
         job["run"]["command"] = command
         yield job
 
 
 @transforms.add
 def add_previous_versions(config, jobs):
     release_config = get_release_config(config)
@@ -52,27 +49,42 @@ def add_previous_versions(config, jobs):
             yield job
 
 
 @transforms.add
 def handle_keyed_by(config, jobs):
     """Resolve fields that can be keyed by project, etc."""
     fields = [
         "run.config",
+        "run.product-field",
         "run.extra-config",
     ]
+
+    release_config = get_release_config(config)
+    version = release_config["version"]
+
     for job in jobs:
         job = copy.deepcopy(job)  # don't overwrite dict values here
         for field in fields:
             resolve_keyed_by(item=job, field=field, item_name=job['name'],
                              project=config.params['project'])
 
         for cfg in job["run"]["config"]:
             job["run"]["command"].extend(["--config", cfg])
 
+        if config.kind == "bouncer-check":
+            job["run"]["command"].extend([
+                "--product-field={}".format(job["run"]["product-field"]),
+                "--products-url={}".format(job["run"]["products-url"]),
+            ])
+            del job["run"]["product-field"]
+            del job["run"]["products-url"]
+        elif config.kind == "release-bouncer-check":
+            job["run"]["command"].append("--version={}".format(version))
+
         del job["run"]["config"]
 
         if 'extra-config' in job['run']:
             env = job['worker'].setdefault('env', {})
             env['EXTRA_MOZHARNESS_CONFIG'] = json.dumps(job['run']['extra-config'])
             del job["run"]["extra-config"]
 
         yield job
--- a/testing/mozharness/scripts/release/bouncer_check.py
+++ b/testing/mozharness/scripts/release/bouncer_check.py
@@ -22,16 +22,26 @@ BOUNCER_URL_PATTERN = "{bouncer_prefix}?
 
 
 class BouncerCheck(BaseScript, VirtualenvMixin):
     config_options = [
         [["--version"], {
             "dest": "version",
             "help": "Version of release, eg: 39.0b5",
         }],
+        [["--product-field"], {
+            "dest": "product_field",
+            "help": "Version field of release from product details, eg: LATEST_FIREFOX_VERSION",
+        }],
+        [["--products-url"], {
+            "dest": "products_url",
+            "help": "The URL of the current Firefox product versions",
+            "type": str,
+            "default": "https://product-details.mozilla.org/1.0/firefox_versions.json",
+        }],
         [["--previous-version"], {
             "dest": "prev_versions",
             "action": "extend",
             "help": "Previous version(s)",
         }],
         [["--locale"], {
             "dest": "locales",
             # Intentionally limited for several reasons:
@@ -71,16 +81,29 @@ class BouncerCheck(BaseScript, Virtualen
             ],
             default_actions=[
                 "create-virtualenv",
                 "activate-virtualenv",
                 "check-bouncer",
             ],
         )
 
+    def _pre_config_lock(self, rw_config):
+        super(BouncerCheck, self)._pre_config_lock(rw_config)
+
+        if "product_field" not in self.config:
+            return
+
+        firefox_versions = self.load_json_url(self.config["products_url"])
+
+        if self.config['product_field'] not in firefox_versions:
+            self.fatal('Unknown Firefox label: {}'.format(self.config['product_field']))
+        self.config["version"] = firefox_versions[self.config["product_field"]]
+        self.log("Set Firefox version {}".format(self.config["version"]))
+
     def check_url(self, session, url):
         from redo import retry
 
         def do_check_url():
             self.log("Checking {}".format(url))
             r = session.head(url, verify=True, timeout=10, allow_redirects=True)
             try:
                 r.raise_for_status()