tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

release_started.py (1672B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 """
      5 Add notifications via taskcluster-notify for release tasks
      6 """
      7 
      8 from shlex import quote as shell_quote
      9 
     10 from taskgraph.transforms.base import TransformSequence
     11 from taskgraph.util.schema import resolve_keyed_by
     12 
     13 transforms = TransformSequence()
     14 
     15 
     16 @transforms.add
     17 def add_notifications(config, jobs):
     18    for job in jobs:
     19        label = "{}-{}".format(config.kind, job["name"])
     20 
     21        resolve_keyed_by(job, "emails", label, project=config.params["project"])
     22        emails = [email.format(config=config.__dict__) for email in job.pop("emails")]
     23 
     24        command = [
     25            "release",
     26            "send-buglist-email",
     27            "--version",
     28            config.params["version"],
     29            "--product",
     30            job["shipping-product"],
     31            "--revision",
     32            config.params["head_rev"],
     33            "--build-number",
     34            str(config.params["build_number"]),
     35            "--repo",
     36            config.params["head_repository"],
     37        ]
     38        for address in emails:
     39            command += ["--address", address]
     40        command += [
     41            # We wrap this in `{'task-reference': ...}` below
     42            "--task-group-id",
     43            "<decision>",
     44        ]
     45 
     46        job["scopes"] = [f"notify:email:{address}" for address in emails]
     47        job["run"] = {
     48            "using": "mach",
     49            "sparse-profile": "mach",
     50            "mach": {"task-reference": " ".join(map(shell_quote, command))},
     51        }
     52 
     53        yield job