From 4d3d22d167d2c03d67db0ffb796edb40cb0ad14f Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Tue, 31 Jan 2023 14:37:58 +0100 Subject: [PATCH] Bug 1808607 - part 2: Migrate notify tasks (cherry picked from commit bbe9c25ce54c89d095d76abdcd0136a9a7bd315b) --- .../ci/release-notify-promote/kind.yml | 44 ----------------- taskcluster/ci/release-notify-ship/kind.yml | 47 ------------------- .../fenix_taskgraph/transforms/notify.py | 36 -------------- .../transforms/release_deps.py | 45 ------------------ 4 files changed, 172 deletions(-) delete mode 100644 taskcluster/ci/release-notify-promote/kind.yml delete mode 100644 taskcluster/ci/release-notify-ship/kind.yml delete mode 100644 taskcluster/fenix_taskgraph/transforms/notify.py delete 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 deleted file mode 100644 index 5db113b9c4..0000000000 --- a/taskcluster/ci/release-notify-promote/kind.yml +++ /dev/null @@ -1,44 +0,0 @@ -# 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/ci/release-notify-ship/kind.yml b/taskcluster/ci/release-notify-ship/kind.yml deleted file mode 100644 index 91c6124fd5..0000000000 --- a/taskcluster/ci/release-notify-ship/kind.yml +++ /dev/null @@ -1,47 +0,0 @@ -# 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 - - github-release - - version-bump - - mark-as-shipped - -primary-dependency: push-apk - -group-by: build-type - -only-for-build-types: - - beta - - release - -task-defaults: - attributes: - shipping_phase: ship - name: notify-release-drivers-ship - description: Sends email to release-drivers telling release was shipped. - worker-type: succeed - worker: - implementation: succeed - notifications: - subject: "{config[params][project]} {config[params][version]} build{config[params][build_number]} has been tagged in GitHub" - 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/notify.py b/taskcluster/fenix_taskgraph/transforms/notify.py deleted file mode 100644 index 565da211ae..0000000000 --- a/taskcluster/fenix_taskgraph/transforms/notify.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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/. -""" -Handle notifications like emails. -""" - -from taskgraph.transforms.base import TransformSequence - -transforms = TransformSequence() - - -@transforms.add -def add_notify_email(config, tasks): - for task in tasks: - notify = task.pop("notify", {}) - email_config = notify.get("email") - if email_config: - extra = task.setdefault("extra", {}) - notify = extra.setdefault("notify", {}) - notify["email"] = { - "content": email_config["content"], - "subject": email_config["subject"], - "link": email_config.get("link", None), - } - - routes = task.setdefault("routes", []) - routes.extend( - [ - "notify.email.{}.on-{}".format(address, reason) - for address in email_config["to-addresses"] - for reason in email_config["on-reasons"] - ] - ) - - yield task diff --git a/taskcluster/fenix_taskgraph/transforms/release_deps.py b/taskcluster/fenix_taskgraph/transforms/release_deps.py deleted file mode 100644 index 58f74b8fff..0000000000 --- a/taskcluster/fenix_taskgraph/transforms/release_deps.py +++ /dev/null @@ -1,45 +0,0 @@ -# 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.values(): - # 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