Bug 1455407: Allow finding the comm-* decision task from the index; r=aki
authorTom Prince <mozilla@hocat.ca>
Fri, 25 May 2018 22:30:09 +0000
changeset 8414 74a7df6d3fc5
parent 8413 e94302d4b606
child 8415 6c6019908ae6
push id6142
push usermozilla@hocat.ca
push date2018-05-25 22:45 +0000
reviewersaki
bugs1455407
Bug 1455407: Allow finding the comm-* decision task from the index; r=aki Differential Revision: https://phabricator.services.mozilla.com/D995
buildfarm/release/release-runner.yml.example
buildfarm/release/release-runner3.py
buildfarm/release/trigger_action.py
lib/python/kickoff/actions.py
--- a/buildfarm/release/release-runner.yml.example
+++ b/buildfarm/release/release-runner.yml.example
@@ -36,26 +36,37 @@ partners:
 
 symlinks:
   production_config.py: "{buildbot_configs}/mozilla/localconfig.py"
   thunderbird_production_config.py: "{buildbot_configs}/mozilla/thunderbird_localconfig.py"
 
 releases:
   - product: firefox
     pattern: Firefox-.*
+    trust_domain: gecko
     checks:
       - long_revision
       - l10n_changesets
       - partial_updates
       - check_allowed_branches
     allowed_branches:
       - mozilla-beta
       - mozilla-release
       - mozilla-esr*
   - product: fennec
     pattern: Fennec-.*
+    trust_domain: gecko
     checks:
       - long_revision
       - check_allowed_branches
     allowed_branches:
       - mozilla-beta
       - mozilla-release
       - mozilla-esr*
+  - product: thunderbird
+    pattern: Thunderbird-.*
+    trust_domain: comm
+    checks:
+      - long_revision
+      - check_allowed_branches
+    allowed_branches:
+      - comm-beta
+      - comm-esr*
--- a/buildfarm/release/release-runner3.py
+++ b/buildfarm/release/release-runner3.py
@@ -34,16 +34,24 @@ log = logging.getLogger(__name__)
 
 def check_and_assign_long_revision(release_runner, release, releases_config):
     # Revisions must be checked before trying to get the long one.
     RevisionsSanitizer(**release).run()
     release['mozillaRevision'] = long_revision(
         release['branch'], release['mozillaRevision'])
 
 
+def get_trust_domain(releases_config, release):
+    product = release['product']
+    for entry in releases_config:
+        if entry['product'] == product:
+            return entry['trust_domain']
+    raise RuntimeError("Unknown trust-domain for product %s", product)
+
+
 def check_allowed_branches(release_runner, release, releases_config):
     product = release['product']
     branch = release['branch']
     for entry in releases_config:
         if entry['product'] == product:
             allowed_branches = entry['allowed_branches']
             for pattern in allowed_branches:
                 if re.match(pattern, branch):
@@ -193,17 +201,20 @@ def main(options):
         try:
             version = release["version"]
             # XXX we may want to move next_version logic to the release_promotion action.
             next_version = bump_version(version.replace("esr", ""))
             project = release["branchShortName"]
             revision = release["mozillaRevision"]
             # XXX we probably want to find a decision task ID for the action, and a separate
             # one for the revision-to-promote, to allow for https://trello.com/c/u6MHrz8y .
-            decision_task_id = find_decision_task_id(project, revision)
+            decision_task_id = find_decision_task_id(
+                trust_domain=get_trust_domain(config['releases'], release),
+                project=project, revision=revision,
+            )
             action_task_input = {
                 "build_number": release["buildNumber"],
                 "next_version": next_version,
                 # specify version rather than relying on in-tree version,
                 # so if a version bump happens between the build and an action task
                 # revision, we still use the correct version.
                 "version": version,
                 "release_promotion_flavor": "promote_{}".format(release["product"]),
@@ -226,18 +237,17 @@ def main(options):
                     # so this isn't a missing feature for RCs specifically.
                     action_task_input["release_promotion_flavor"] = "{}_rc".format(
                         action_task_input["release_promotion_flavor"]
                     )
             if not is_partner_enabled(release, partner_config['partner_min_version']):
                 action_task_input['release_enable_emefree'] = False
                 action_task_input['release_enable_partners'] = False
             action_task_id, action_task = generate_action_task(
-                project=release["branchShortName"],
-                revision=release["mozillaRevision"],
+                decision_task_id=decision_task_id,
                 action_task_input=action_task_input,
             )
             submit_action_task(queue=queue, action_task_id=action_task_id,
                                action_task=action_task)
             rr.mark_as_completed(release)
             l10n_url = rr.release_l10n_api.getL10nFullUrl(release['name'])
             email_release_drivers(smtp_server=smtp_server, from_=notify_from,
                                   to=notify_to, release=release,
--- a/buildfarm/release/trigger_action.py
+++ b/buildfarm/release/trigger_action.py
@@ -22,16 +22,18 @@ SUPPORTED_ACTIONS = [
     "publish_fennec",
     "push_devedition",
     "push_firefox",
     "ship_devedition",
     "ship_fennec",
     "ship_fennec_rc",
     "ship_firefox",
     "ship_firefox_rc",
+    "push_thunderbird",
+    "ship_thunderbird",
 ]
 
 
 def get_task(task_id):
     queue = taskcluster.Queue()
     return queue.task(task_id)
 
 
@@ -128,18 +130,17 @@ def main():
     })
     if 'partner' in args.action_flavor:
         action_task_input.update({
             "release_partner_build_number": args.partner_build_num,
         })
         if args.partner_subset:
             action_task_input['release_partners'] = args.partner_subset.split(',')
     action_task_id, action_task = generate_action_task(
-            project=project,
-            revision=revision,
+            decision_task_id=decision_task_id,
             action_task_input=action_task_input,
     )
 
     log.info("Submitting action task %s for %s", action_task_id, args.action_flavor)
     log.info("Project: %s", project)
     log.info("Revision: %s", revision)
     log.info("Next version: %s", action_task_input["next_version"])
     log.info("Build number: %s", action_task_input["build_number"])
--- a/lib/python/kickoff/actions.py
+++ b/lib/python/kickoff/actions.py
@@ -19,26 +19,28 @@ def find_action(name, actions):
 
 def fetch_actions_json(task_id):
     queue = taskcluster.Queue()
     actions_url = queue.buildUrl("getLatestArtifact", task_id, 'public/actions.json')
     q = requests.get(actions_url)
     q.raise_for_status()
     return q.json()
 
-
-def find_decision_task_id(project, revision):
-    decision_task_route = "gecko.v2.{project}.revision.{revision}.firefox.decision".format(
-         project=project, revision=revision)
+def find_decision_task_id(trust_domain, project, revision):
+    decision_task_route = "{trust_domain}.v2.{project}.revision.{revision}.taskgraph.decision".format(
+        trust_domain=trust_domain,
+        project=project,
+        revision=revision,
+    )
     index = taskcluster.Index()
     return index.findTask(decision_task_route)["taskId"]
 
 
-def generate_action_task(project, revision, action_task_input):
-    actions = fetch_actions_json(find_decision_task_id(project, revision))
+def generate_action_task(decision_task_id, action_task_input):
+    actions = fetch_actions_json(decision_task_id)
     relpro = find_action("release-promotion", actions)
     context = copy.deepcopy(actions["variables"])  # parameters
     action_task_id = slugid.nice()
     context.update({
         "input": action_task_input,
         "ownTaskId": action_task_id,
         "taskId": None,
         "task": None,