# 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/. """
Source-test jobs can run on multiple platforms. These transforms allow jobs with either `platform` or a list of `platforms`, and set the appropriate
treeherder configuration and attributes for that platform. """
import copy import os
from taskgraph.transforms.base import TransformSequence from taskgraph.util.attributes import keymatch from taskgraph.util.schema import Schema, optionally_keyed_by, resolve_keyed_by from taskgraph.util.treeherder import join_symbol, split_symbol from voluptuous import Any, Extra, Optional, Required
from gecko_taskgraph.transforms.job import job_description_schema
source_test_description_schema = Schema(
{ # most fields are passed directly through as job fields, and are not # repeated here
Extra: object, # The platform on which this task runs. This will be used to set up attributes # (for try selection) and treeherder metadata (for display). If given as a list, # the job will be "split" into multiple tasks, one with each platform.
Required("platform"): Any(str, [str]), # Build labels required for the task. If this key is provided it must # contain a build label for the task platform. # The task will then depend on a build task, and the installer url will be # saved to the GECKO_INSTALLER_URL environment variable.
Optional("require-build"): optionally_keyed_by("project", {str: str}), # These fields can be keyed by "platform", and are otherwise identical to # job descriptions.
Required("worker-type"): optionally_keyed_by( "platform", job_description_schema["worker-type"]
),
Required("worker"): optionally_keyed_by( "platform", job_description_schema["worker"]
),
Optional("python-version"): [int],
Optional("dependencies"): {
k: optionally_keyed_by("platform", v) for k, v in job_description_schema["dependencies"].items()
}, # A list of artifacts to install from 'fetch' tasks.
Optional("fetches"): {
str: optionally_keyed_by( "platform", job_description_schema["fetches"][str]
),
},
}
)
@transforms.add def handle_platform(config, jobs): """
Handle the 'platform' property, setting up treeherder context as well as
try-related attributes. """
fields = [ "always-target", "fetches.toolchain", "require-build", "worker-type", "worker",
]
for job in jobs:
platform = job["platform"]
for field in fields:
resolve_keyed_by(
job, field, item_name=job["name"], project=config.params["project"]
) for field in job.get("dependencies", {}):
resolve_keyed_by(
job,
f"dependencies.{field}",
item_name=job["name"],
project=config.params["project"],
)
for job in jobs: ifnot job.get("shell"): yield job continue
for field in fields:
resolve_keyed_by(job, field, item_name=job["name"])
del job["shell"] yield job
@transforms.add def set_code_review_env(config, jobs): """
Add a CODE_REVIEW environment variable when running in code-review bot mode """
is_code_review = config.params["target_tasks_method"] == "codereview"
for job in jobs:
attrs = job.get("attributes", {}) if is_code_review and attrs.get("code-review") isTrue:
env = job["worker"].setdefault("env", {})
env["CODE_REVIEW"] = "1"
yield job
@transforms.add def set_worker_exit_code(config, jobs): for job in jobs:
worker = job["worker"]
worker.setdefault("retry-exit-status", []) if 137 notin worker["retry-exit-status"]:
worker["retry-exit-status"].append(137) yield job
@transforms.add def remove_optimization_on_central(config, jobs): """ For pushes to mozilla-central run all source-test tasks that are enabled for
code-review in order to have the code-review bot populate the DB according with the push hash. """ if (
config.params["project"] != "mozilla-central" or config.params["tasks_for"] != "hg-push"
): yieldfrom jobs return
for job in jobs: ifnot job.get("attributes", {}).get("code-review", False): yield job continue if"when"in job: del job["when"] if"optimization"in job and"skip-unless-mozlint"in job["optimization"]: del job["optimization"] yield job
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.