From 4334e982bfde971a4223e6ca7fe013763748e972 Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Wed, 27 Jul 2022 19:05:53 +0200 Subject: [PATCH] Bug 1781248 - part 3: Add email notification when the promote phase is over --- .../ci/release-notify-promote/kind.yml | 44 ++++++++++++++++++ .../transforms/release_deps.py | 45 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 taskcluster/ci/release-notify-promote/kind.yml create mode 100644 taskcluster/fenix_taskgraph/transforms/release_deps.py diff --git a/taskcluster/ci/release-notify-promote/kind.yml b/taskcluster/ci/release-notify-promote/kind.yml new file mode 100644 index 000000000..5db113b9c --- /dev/null +++ b/taskcluster/ci/release-notify-promote/kind.yml @@ -0,0 +1,44 @@ +# 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: + - fenix_taskgraph.transforms.release_deps:transforms + - taskgraph.transforms.release_notifications:transforms + - taskgraph.transforms.task:transforms + +kind-dependencies: + - push-apk + +primary-dependency: push-apk + +group-by: build-type + +only-for-build-types: + - beta + - release + +task-defaults: + attributes: + shipping_phase: promote + name: notify-release-drivers-promote + description: Sends email to release-drivers telling release was promoted. + worker-type: succeed + worker: + implementation: succeed + notifications: + subject: "{config[params][project]} {config[params][version]} build{config[params][build_number]} has been pushed to the closed testing track on Google Play" + emails: + by-level: + '3': ["release-signoff@mozilla.org"] + default: ["{config[params][owner]}"] + +tasks: + beta: + attributes: + release-type: beta + release: + attributes: + release-type: release diff --git a/taskcluster/fenix_taskgraph/transforms/release_deps.py b/taskcluster/fenix_taskgraph/transforms/release_deps.py new file mode 100644 index 000000000..3c218ed26 --- /dev/null +++ b/taskcluster/fenix_taskgraph/transforms/release_deps.py @@ -0,0 +1,45 @@ +# 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/. +""" +Add dependencies to release tasks. +""" + +from taskgraph.transforms.base import TransformSequence + +PHASES = ["build", "promote", "push", "ship"] + +transforms = TransformSequence() + + +@transforms.add +def add_dependencies(config, tasks): + for task in tasks: + dependencies = {} + # Add any kind_dependencies_tasks with matching release_type as dependencies + release_type = task["attributes"].get("release-type") + phase = task["attributes"].get("shipping_phase") + if release_type 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. + + # 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 release_type tasks to deps + if ( + dep_task.task.get("release-type") == release_type + or dep_task.attributes.get("release-type") == release_type + ): + dependencies[dep_task.label] = dep_task.label + + task.setdefault("dependencies", {}).update(dependencies) + + yield task