Bug 1839891 - [ci] Remove the 'single_dep' loader, r=releng-reviewers,taskgraph-reviewers,hneiva,bhearsum

Differential Revision: https://phabricator.services.mozilla.com/D193079
This commit is contained in:
Andrew Halberstadt 2023-11-14 20:32:57 +00:00
Родитель 7525d283e3
Коммит a05ee33016
5 изменённых файлов: 6 добавлений и 90 удалений

Просмотреть файл

@ -1,76 +0,0 @@
# 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/.
from taskgraph.task import Task
from taskgraph.util.schema import Schema
from voluptuous import Required
from gecko_taskgraph.util.copy_task import copy_task
schema = Schema(
{
Required("primary-dependency", "primary dependency task"): Task,
}
)
def loader(kind, path, config, params, loaded_tasks):
"""
Load tasks based on the jobs dependant kinds.
The `only-for-build-platforms` kind configuration, if specified, will limit
the build platforms for which a job will be created. Alternatively there is
'not-for-build-platforms' kind configuration which will be consulted only after
'only-for-build-platforms' is checked (if present), and omit any jobs where the
build platform matches.
Optional `only-for-attributes` kind configuration, if specified, will limit
the jobs chosen to ones which have the specified attribute, with the specified
value.
Optional `job-template` kind configuration value, if specified, will be used to
pass configuration down to the specified transforms used.
"""
only_platforms = config.get("only-for-build-platforms")
not_platforms = config.get("not-for-build-platforms")
only_attributes = config.get("only-for-attributes")
job_template = config.get("job-template")
for task in loaded_tasks:
if task.kind not in config.get("kind-dependencies", []):
continue
if only_platforms or not_platforms:
build_platform = task.attributes.get("build_platform")
build_type = task.attributes.get("build_type")
if not build_platform or not build_type:
continue
platform = f"{build_platform}/{build_type}"
if only_platforms and platform not in only_platforms:
continue
elif not_platforms and platform in not_platforms:
continue
if only_attributes:
config_attrs = set(only_attributes)
if not config_attrs & set(task.attributes):
# make sure any attribute exists
continue
job = {
"primary-dependency": task,
}
if job_template:
job.update(copy_task(job_template))
# copy shipping_product from upstream
product = task.attributes.get(
"shipping_product", task.task.get("shipping-product")
)
if product:
job.setdefault("shipping-product", product)
yield job

Просмотреть файл

@ -24,12 +24,8 @@ transforms.add(apply_partner_priority)
@transforms.add
def chunk_partners(config, jobs):
for job in jobs:
# We need to support both the `multi_dep` and `from_deps` approach for now.
if "primary-dependency" in job:
dep_job = job["primary-dependency"]
else:
dep_job = get_primary_dependency(config, job)
assert dep_job
dep_job = get_primary_dependency(config, job)
assert dep_job
build_platform = dep_job.attributes["build_platform"]
repack_id = dep_job.task.get("extra", {}).get("repack_id")

Просмотреть файл

@ -108,7 +108,7 @@ l10n_description_schema = Schema(
Optional("env"): _by_platform({str: taskref_or_string}),
# Max number locales per chunk
Optional("locales-per-chunk"): _by_platform(int),
# Task deps to chain this task with, added in transforms from primary-dependency
# Task deps to chain this task with, added in transforms from primary dependency
# if this is a shippable-style build
Optional("dependencies"): {str: str},
# Run the task when the listed files change (if present).

Просмотреть файл

@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Generate labels for tasks without names, consistently.
Uses attributes from `primary-dependency`.
Uses attributes from primary dependency.
"""
from taskgraph.transforms.base import TransformSequence
@ -17,10 +17,8 @@ def make_label(config, jobs):
"""Generate a sane label for a new task constructed from a dependency
Using attributes from the dependent job and the current task kind"""
for job in jobs:
if "primary-dependency" in job:
dep_job = job["primary-dependency"]
else:
dep_job = get_primary_dependency(config, job)
dep_job = get_primary_dependency(config, job)
assert dep_job
attr = dep_job.attributes.get

Просмотреть файл

@ -446,8 +446,6 @@ def generate_beetmover_upstream_artifacts(
if not dependencies:
if job.get("dependencies"):
dependencies = job["dependencies"].keys()
elif job.get("primary-dependency"):
dependencies = [job["primary-dependency"].kind]
else:
raise Exception(f"Unsupported type of dependency. Got job: {job}")