Bug 1921559 - Email thunderbird-drivers when promoting build on comm-release. r=thunderbird-build-system-reviewers,coreycbryant
Differential Revision: https://phabricator.services.mozilla.com/D224024 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
85def2b630
Коммит
3636320972
|
@ -70,9 +70,11 @@ def initialize(topsrcdir, args=()):
|
|||
"tb-l10n-x-channel": MachCommandReference("comm/python/l10n/mach_commands.py"),
|
||||
"tb-rust": MachCommandReference("comm/rust/mach_commands.py"),
|
||||
"tb-storybook": MachCommandReference("comm/mail/components/storybook/mach_commands.py"),
|
||||
"tb-release": MachCommandReference("comm/python/mach_commands.py"),
|
||||
}
|
||||
MACH_COMMANDS.update(COMM_MACH_COMMANDS)
|
||||
|
||||
# Gets added afterward since it's adding a new subcommand to "mach release"
|
||||
driver = mach_init.initialize(topsrcdir, args)
|
||||
|
||||
return driver
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
# 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/.
|
||||
|
||||
import os
|
||||
|
||||
from mozilla_version.gecko import GeckoVersion
|
||||
|
||||
from mach.decorators import Command, CommandArgument, SubCommand
|
||||
|
||||
|
||||
@Command("tb-release", category="thunderbird", virtualenv_name="tb_common")
|
||||
def tb_release(command_context):
|
||||
pass
|
||||
|
||||
|
||||
@SubCommand(
|
||||
"tb-release",
|
||||
"send-buglist-email-thunderbird",
|
||||
description="Send an email with the bugs since the last release.",
|
||||
)
|
||||
@CommandArgument(
|
||||
"--address",
|
||||
required=True,
|
||||
action="append",
|
||||
dest="addresses",
|
||||
help="The email address to send the bug list to " "(may be specified more than once.",
|
||||
)
|
||||
@CommandArgument(
|
||||
"--version",
|
||||
type=GeckoVersion.parse,
|
||||
required=True,
|
||||
help="The version being built.",
|
||||
)
|
||||
@CommandArgument("--product", required=True, help="The product being built.")
|
||||
@CommandArgument("--repo", required=True, help="The repo being built.")
|
||||
@CommandArgument("--revision", required=True, help="The revision being built.")
|
||||
@CommandArgument("--build-number", required=True, help="The build number")
|
||||
@CommandArgument("--task-group-id", help="The task group of the build.")
|
||||
@CommandArgument("--prefix-message", help="A message to insert into the email body.")
|
||||
def buglist_email(
|
||||
command_context,
|
||||
addresses,
|
||||
product,
|
||||
version,
|
||||
repo,
|
||||
revision,
|
||||
build_number,
|
||||
task_group_id,
|
||||
prefix_message,
|
||||
):
|
||||
import base64
|
||||
|
||||
from mozrelease.buglist_creator import create_bugs_url
|
||||
|
||||
from rocbuild.machutil import setup_logging
|
||||
from rocbuild.notify import email_notification
|
||||
|
||||
setup_logging(command_context)
|
||||
|
||||
email_buglist_string = create_bugs_url(product, version, revision, repo=repo)
|
||||
|
||||
if prefix_message is not None:
|
||||
_msg = base64.b64decode(bytes(prefix_message.encode("utf-8"))).decode()
|
||||
release_prefix_msg = f"\n{_msg}\n"
|
||||
else:
|
||||
release_prefix_msg = ""
|
||||
|
||||
content = """\
|
||||
A new build has been started:
|
||||
{release_prefix_msg}
|
||||
Commit: [{revision}]({repo}/rev/{revision})
|
||||
Task group: [{task_group_id}]({root_url}/tasks/groups/{task_group_id})
|
||||
|
||||
{email_buglist_string}
|
||||
""".format(
|
||||
release_prefix_msg=release_prefix_msg,
|
||||
repo=repo,
|
||||
revision=revision,
|
||||
root_url=os.environ["TASKCLUSTER_ROOT_URL"],
|
||||
task_group_id=task_group_id,
|
||||
email_buglist_string=email_buglist_string,
|
||||
)
|
||||
print(content)
|
||||
subject = "[Thunderbird] Build of {} {} build {}".format(product, version, build_number)
|
||||
email_notification(subject, content, addresses)
|
|
@ -0,0 +1,29 @@
|
|||
# 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/.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
|
||||
def setup_logging(command_context, quiet=False, verbose=True):
|
||||
"""
|
||||
Set up Python logging for all loggers, sending results to stderr (so
|
||||
that command output can be redirected easily) and adding the typical
|
||||
mach timestamp.
|
||||
"""
|
||||
# remove the old terminal handler
|
||||
old = command_context.log_manager.replace_terminal_handler(None)
|
||||
|
||||
# re-add it, with level and fh set appropriately
|
||||
if not quiet:
|
||||
level = logging.DEBUG if verbose else logging.INFO
|
||||
command_context.log_manager.add_terminal_logging(
|
||||
fh=sys.stderr,
|
||||
level=level,
|
||||
write_interval=old.formatter.write_interval,
|
||||
write_times=old.formatter.write_times,
|
||||
)
|
||||
|
||||
# all of the taskgraph logging is unstructured logging
|
||||
command_context.log_manager.enable_unstructured()
|
|
@ -7,6 +7,10 @@ vendored:comm/third_party/python/fluent.migratetb
|
|||
vendored:third_party/python/compare_locales
|
||||
vendored:third_party/python/fluent.migrate
|
||||
vendored:third_party/python/fluent.syntax
|
||||
vendored:third_party/python/mohawk
|
||||
vendored:third_party/python/packaging
|
||||
vendored:third_party/python/slugid
|
||||
vendored:third_party/python/taskcluster
|
||||
vendored:third_party/python/taskcluster_urls
|
||||
vendored:third_party/python/toml
|
||||
vendored:third_party/python/typing_extensions
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
Add notifications via taskcluster-notify for release tasks
|
||||
"""
|
||||
|
||||
import base64
|
||||
from pipes import quote as shell_quote
|
||||
|
||||
from taskgraph.transforms.base import TransformSequence
|
||||
|
@ -21,9 +22,14 @@ def add_notifications(config, jobs):
|
|||
resolve_keyed_by(job, "emails", label, project=config.params["project"])
|
||||
emails = [email.format(config=config.__dict__) for email in job.pop("emails")]
|
||||
|
||||
resolve_keyed_by(job, "prefix-message", label, project=config.params["project"])
|
||||
prefix_message = ""
|
||||
if msg := job.pop("prefix-message"):
|
||||
prefix_message = base64.b64encode(bytes(msg.encode("utf-8"))).decode()
|
||||
|
||||
command = [
|
||||
"release",
|
||||
"send-buglist-email",
|
||||
"tb-release",
|
||||
"send-buglist-email-thunderbird",
|
||||
"--version",
|
||||
config.params["version"],
|
||||
"--product",
|
||||
|
@ -34,6 +40,8 @@ def add_notifications(config, jobs):
|
|||
str(config.params["build_number"]),
|
||||
"--repo",
|
||||
config.params["comm_head_repository"],
|
||||
"--prefix-message",
|
||||
prefix_message,
|
||||
]
|
||||
for address in emails:
|
||||
command += ["--address", address]
|
||||
|
@ -46,6 +54,7 @@ def add_notifications(config, jobs):
|
|||
job["scopes"] = ["notify:email:{}".format(address) for address in emails]
|
||||
job["run"] = {
|
||||
"using": "mach",
|
||||
"comm-checkout": True,
|
||||
"sparse-profile": "mach",
|
||||
"mach": {"task-reference": " ".join(map(shell_quote, command))},
|
||||
}
|
||||
|
|
|
@ -21,9 +21,16 @@ task-defaults:
|
|||
max-run-time: 600
|
||||
emails:
|
||||
by-project:
|
||||
comm-(beta|esr.*): ["thunderbird-drivers@mozilla.org"]
|
||||
comm-(beta|release|esr.*): ["thunderbird-drivers@mozilla.org"]
|
||||
try-comm-central: ["{config[params][owner]}"]
|
||||
default: []
|
||||
prefix-message:
|
||||
by-project:
|
||||
comm-release: |
|
||||
**This is a preview release of Thunderbird's monthly releases.**
|
||||
|
||||
Thunderbird monthly releases are not considered stable for general use.
|
||||
default: null
|
||||
|
||||
tasks:
|
||||
thunderbird:
|
||||
|
|
Загрузка…
Ссылка в новой задаче