Skip to content

Commit

Permalink
ci: Fix 'release-notify' task to display all upload directories on sh…
Browse files Browse the repository at this point in the history
…ip-client phase (#9155)
  • Loading branch information
ahal authored Feb 20, 2024
1 parent dd4b224 commit 81f1648
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
37 changes: 24 additions & 13 deletions taskcluster/mozillavpn_taskgraph/transforms/beetmover.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"]:
Expand All @@ -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"]
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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,
)
)

Expand Down Expand Up @@ -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 = (
Expand All @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions taskcluster/mozillavpn_taskgraph/transforms/release_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<a href="{d[0]}">{d[1]}</a>'
matrix_context["destinations"] += f'\t<a href="{dest}">{platform}</a>'

slack_message = json.loads(SLACK_TEMPLATE.substitute(**slack_context))
task.setdefault("notify", {}).setdefault("content", {}).setdefault("slack", {})[
Expand Down

0 comments on commit 81f1648

Please sign in to comment.