From f348057c1a24bf57c486fd321bd86a2ddb8aacb0 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Thu, 15 Feb 2024 15:20:55 -0500 Subject: [PATCH] ci: Fix 'release-notify' task to display all upload directories on ship-client phase --- .../transforms/beetmover.py | 37 ++++++++++++------- .../transforms/release_notify.py | 11 +++--- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/taskcluster/mozillavpn_taskgraph/transforms/beetmover.py b/taskcluster/mozillavpn_taskgraph/transforms/beetmover.py index cb9e22aa7a..ccb1546155 100644 --- a/taskcluster/mozillavpn_taskgraph/transforms/beetmover.py +++ b/taskcluster/mozillavpn_taskgraph/transforms/beetmover.py @@ -7,6 +7,7 @@ from taskgraph.transforms.base import TransformSequence from taskgraph.transforms.task import task_description_schema +from taskgraph.util.dependencies import get_dependencies from taskgraph.util.schema import Schema from voluptuous import Extra, Optional, Required @@ -77,7 +78,7 @@ def add_beetmover_worker_config(config, tasks): "android/x64": "android", "android/armv7": "android", "android/arm64-v8a": "android", - "linux64/release-deb": "linux" + "linux64/release-deb": "linux", } if config.params["version"]: @@ -94,7 +95,7 @@ def add_beetmover_worker_config(config, tasks): archive_url = ( "https://ftp.mozilla.org/" if is_production else "https://ftp.stage.mozaws.net/" ) - short_phase = config.kind[len("beetmover-"):] + short_phase = config.kind[len("beetmover-") :] for task in tasks: worker_type = task["worker-type"] @@ -129,7 +130,7 @@ def add_beetmover_worker_config(config, tasks): "build-id": build_id, "platform": build_type, }, - "upstream-artifacts": upstream_artifacts + "upstream-artifacts": upstream_artifacts, } destination_paths = [] @@ -167,14 +168,12 @@ def add_beetmover_worker_config(config, tasks): ) ) elif phase == "ship-client": - assert build_os destination_paths.append( os.path.join( "pub", "vpn", "releases", app_version, - build_os, ) ) @@ -203,9 +202,7 @@ def add_beetmover_worker_config(config, tasks): } dest = ( - f"{archive_url}{destination_paths[0]}" - if destination_paths - else archive_url + f"{archive_url}{destination_paths[0]}" if destination_paths else archive_url ) if build_type == "addons/opt": task_description = ( @@ -216,11 +213,25 @@ def add_beetmover_worker_config(config, tasks): else: task_description = f"This {worker_type} task will upload a {build_os} release candidate for v{app_version} to {dest}/" - extra = { - "release_destinations": [ - f"{archive_url}{dest}/" for dest in destination_paths - ] - } + if task["beetmover-action"] == "push-to-releases": + extra = {"release_destinations": {}} + for dep in get_dependencies(config, task): + extra["release_destinations"].update( + { + platform: f"{dest}/{platform}/" + for platform in dep.task["extra"]["release_destinations"] + } + ) + else: + key = "addons" if "addons" in phase else build_os + extra = { + "release_destinations": { + key: f"{archive_url}{dest}/" + for dest in destination_paths + if "latest" not in dest + } + } + task_def = { "name": task["name"], "description": task_description, diff --git a/taskcluster/mozillavpn_taskgraph/transforms/release_notify.py b/taskcluster/mozillavpn_taskgraph/transforms/release_notify.py index 573fd701e2..a8f41aebf3 100644 --- a/taskcluster/mozillavpn_taskgraph/transforms/release_notify.py +++ b/taskcluster/mozillavpn_taskgraph/transforms/release_notify.py @@ -129,24 +129,23 @@ def format_message(config, tasks): } matrix_context = slack_context.copy() - dirs = set() + dirs = {} for label, dep_task in config.kind_dependencies_tasks.items(): if label not in task["dependencies"] or not dep_task.kind.startswith("beetmover"): continue - platform = dep_task.attributes["build-type"].rsplit("/")[0] - dirs.add((dep_task.task["extra"]["release_destinations"][0], platform)) + dirs.update(dep_task.task["extra"]["release_destinations"]) - for i, d in enumerate(dirs): + for i, (platform, dest) in enumerate(dirs.items()): slack_context["destinations"] += dedent( f""" {{ "type": "mrkdwn", - "text": "<{d[0]}|{d[1]}>" + "text": "<{dest}|{platform}>" }}{"," if i != len(dirs) - 1 else ""} """.lstrip() ) - matrix_context["destinations"] += f'\t{d[1]}' + matrix_context["destinations"] += f'\t{platform}' slack_message = json.loads(SLACK_TEMPLATE.substitute(**slack_context)) task.setdefault("notify", {}).setdefault("content", {}).setdefault("slack", {})[