bug 1423081 - add dynamic dep_tasks based on shipping-phase. r=callek draft
authorAki Sasaki <asasaki@mozilla.com>
Tue, 05 Dec 2017 19:26:31 -0800
changeset 711431 8b7f5c85e169010c73f8b02a5e5e38fb30bbd523
parent 711430 4f3853517e1e20406c5767c965f51bc86fa89869
child 711432 a88f527dfd0c7a2bcc3341b44c5802000af0fd6e
push id93069
push userasasaki@mozilla.com
push dateWed, 13 Dec 2017 22:57:07 +0000
reviewerscallek
bugs1423081
milestone59.0a1
bug 1423081 - add dynamic dep_tasks based on shipping-phase. r=callek MozReview-Commit-ID: 23HK0N523Q7
taskcluster/ci/release-notify-push/kind.yml
taskcluster/taskgraph/transforms/release_deps.py
new file mode 100644
--- /dev/null
+++ b/taskcluster/ci/release-notify-push/kind.yml
@@ -0,0 +1,61 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+loader: taskgraph.loader.transform:loader
+
+transforms:
+   - taskgraph.transforms.release_deps:transforms
+   - taskgraph.transforms.task:transforms
+
+kind-dependencies:
+   - beetmover-cdns
+
+job-defaults:
+   name: notify-release-drivers-push
+   description: Sends email to release-drivers telling release was pushed.
+   run-on-projects: []
+   shipping-phase: push
+   worker-type: aws-provisioner-v1/gecko-{level}-b-linux
+   worker:
+      implementation: docker-worker
+      os: linux
+      docker-image: "ubuntu:16.10"
+      max-run-time: 600
+      command:
+         - /bin/bash
+         - -c
+         - echo "Dummy task"
+   notifications:
+      completed:
+         subject: "{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]} has been pushed to releases"
+         message: "{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]} has been pushed to releases"
+         plugins: ["ses"]
+         emails:
+            by-project:
+               mozilla-beta: ["release-signoff@mozilla.org"]
+               mozilla-release: ["release-signoff@mozilla.org"]
+               try: ["{task_def[metadata][owner]}"]
+               maple: ["release+tcstaging@mozilla.com"]
+               default: []
+   routes:
+      - index.releases.v1.{branch}.{revision}.{product}.{underscore_version}.build{build_number}.email-{channel}
+      - index.releases.v1.{branch}.latest.{product}.latest.email-{channel}
+   index:
+      type: release
+      channel:
+         by-project:
+            mozilla-beta: beta-cdns
+            mozilla-release: release-cdns
+            maple: maple-cdns
+            default: unknown
+
+jobs:
+   firefox:
+      shipping-product: firefox
+      index:
+         product: firefox
+   devedition:
+      shipping-product: devedition
+      index:
+         product: devedition
--- a/taskcluster/taskgraph/transforms/release_deps.py
+++ b/taskcluster/taskgraph/transforms/release_deps.py
@@ -4,16 +4,18 @@
 """
 Add dependencies to release tasks.
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 from taskgraph.transforms.base import TransformSequence
 
+PHASES = ['build', 'promote', 'push', 'ship']
+
 transforms = TransformSequence()
 
 
 def _get_product(job_or_task):
     # Find the product.
     # XXX Once shipping-product is set for nightly builds as well, we can get
     # rid of this function.
     product = job_or_task.get('shipping-product', job_or_task.get('product'))
@@ -31,31 +33,37 @@ def _get_product(job_or_task):
 
 
 @transforms.add
 def add_dependencies(config, jobs):
     for job in jobs:
         dependencies = {}
         # Add any kind_dependencies_tasks with matching product as dependencies
         product = _get_product(job)
+        phase = job.get('shipping-phase')
         if product is None:
             continue
 
         for dep_task in config.kind_dependencies_tasks:
             # Weed out unwanted tasks.
             # XXX we have run-on-projects which specifies the on-push behavior;
             # we need another attribute that specifies release promotion,
             # possibly which action(s) each task belongs in.
             if product == 'fennec':
                 # Don't ship single locale fennec anymore - Bug 1408083
                 attr = dep_task.attributes.get
                 if attr("locale") or attr("chunk_locales"):
                     continue
                 # Skip old-id
                 if 'old-id' in dep_task.label:
                     continue
+            # We can only depend on tasks in the current or previous phases
+            dep_phase = dep_task.attributes.get('shipping_phase')
+            if dep_phase and PHASES.index(dep_phase) > PHASES.index(phase):
+                continue
             # Add matching product tasks to deps
-            if _get_product(dep_task.task) == product:
+            if _get_product(dep_task.task) == product or \
+                    dep_task.attributes.get('shipping_product') == product:
                 dependencies[dep_task.label] = dep_task.label
 
         job.setdefault('dependencies', {}).update(dependencies)
 
         yield job