1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
# 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/.
"""
Transform the beetmover task into an actual task description.
"""
from urllib.parse import urlsplit
from taskgraph.transforms.base import TransformSequence
from taskgraph.util.schema import resolve_keyed_by
from gecko_taskgraph.transforms.task import get_branch_repo, get_branch_rev
from gecko_taskgraph.util.attributes import release_level
from gecko_taskgraph.util.scriptworker import get_release_config
transforms = TransformSequence()
# The beta regexes do not match point releases.
# In the rare event that we do ship a point
# release to beta, we need to either:
# 1) update these regexes to match that specific version
# 2) pass a second include version that matches that specific version
INCLUDE_VERSION_REGEXES = {
"beta": r"'^(\d+\.\d+(b\d+)?)$'",
"nonbeta": r"'^\d+\.\d+(\.\d+)?$'",
# Same as nonbeta, except for the esr suffix
"esr": r"'^\d+\.\d+(\.\d+)?esr$'",
# Previous esr versions, for update testing before we update users to esr140
"esr140-next": r"'^(52|60|68|78|91|102|115|128)+\.\d+(\.\d+)?esr$'",
}
MAR_CHANNEL_ID_OVERRIDE_REGEXES = {
"beta": r"'^\d+\.\d+(\.\d+)?$$,firefox-mozilla-beta,firefox-mozilla-release'",
}
def ensure_wrapped_singlequote(regexes):
"""Ensure that a regex (from INCLUDE_VERSION_REGEXES or MAR_CHANNEL_ID_OVERRIDE_REGEXES)
is wrapper in single quotes.
"""
for name, regex in regexes.items():
if regex[0] != "'" or regex[-1] != "'":
raise Exception(
f"Regex {name} is invalid: not wrapped with single quotes.\n{regex}"
)
ensure_wrapped_singlequote(INCLUDE_VERSION_REGEXES)
ensure_wrapped_singlequote(MAR_CHANNEL_ID_OVERRIDE_REGEXES)
@transforms.add
def add_command(config, tasks):
keyed_by_args = [
"channel",
"archive-prefix",
"previous-archive-prefix",
"aus-server",
"override-certs",
"include-version",
"mar-channel-id-override",
"last-watershed",
]
optional_args = [
"updater-platform",
]
release_config = get_release_config(config)
for task in tasks:
task["description"] = "generate update verify config for {}".format(
task["attributes"]["build_platform"]
)
llbv_arg = ()
if last_linux_bz2_version := task["extra"].get("last-linux-bz2-version", None):
llbv_arg = ("--last-linux-bz2-version", last_linux_bz2_version)
command = [
"python",
"testing/mozharness/scripts/release/update-verify-config-creator.py",
"--product",
task["extra"]["product"],
"--stage-product",
task["shipping-product"],
"--app-name",
task["extra"]["app-name"],
"--branch-prefix",
task["extra"]["branch-prefix"],
"--platform",
task["extra"]["platform"],
"--to-version",
release_config["version"],
"--to-app-version",
release_config["appVersion"],
"--to-build-number",
str(release_config["build_number"]),
"--to-buildid",
config.params["moz_build_date"],
"--to-revision",
get_branch_rev(config),
*llbv_arg,
"--output-file",
"update-verify.cfg",
"--local-repo",
".",
]
repo_path = urlsplit(get_branch_repo(config)).path.lstrip("/")
command.extend(["--repo-path", repo_path])
if release_config.get("partial_versions"):
for partial in release_config["partial_versions"].split(","):
command.extend(["--partial-version", partial.split("build")[0]])
for arg in optional_args:
if task["extra"].get(arg):
command.append(f"--{arg}")
command.append(task["extra"][arg])
for arg in keyed_by_args:
thing = f"extra.{arg}"
resolve_keyed_by(
task,
thing,
item_name=task["name"],
platform=task["attributes"]["build_platform"],
**{
"release-type": config.params["release_type"],
"release-level": release_level(config.params["project"]),
},
)
# ignore things that resolved to null
if not task["extra"].get(arg):
continue
if arg == "include-version":
task["extra"][arg] = INCLUDE_VERSION_REGEXES[task["extra"][arg]]
if arg == "mar-channel-id-override":
task["extra"][arg] = MAR_CHANNEL_ID_OVERRIDE_REGEXES[task["extra"][arg]]
command.append(f"--{arg}")
command.append(task["extra"][arg])
task["run"].update(
{
"using": "mach",
"mach": " ".join(command),
}
)
if task.get("index"):
task["index"].setdefault(
"job-name",
f"update-verify-config-{task['name']}-{task['extra']['channel']}",
)
yield task
|