Bug 1580778 - Migrate signing tasks to taskgraph (#5409)
parent
1777b5a830
commit
bcdc22a2f4
@ -0,0 +1,74 @@
|
|||||||
|
# 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/.
|
||||||
|
---
|
||||||
|
loader: taskgraph.loader.transform:loader
|
||||||
|
|
||||||
|
transforms:
|
||||||
|
- fenix_taskgraph.signing:transforms
|
||||||
|
- taskgraph.transforms.task:transforms
|
||||||
|
|
||||||
|
kind-dependencies:
|
||||||
|
- old-decision
|
||||||
|
|
||||||
|
job-defaults:
|
||||||
|
description: Sign Fenix
|
||||||
|
index:
|
||||||
|
type: signing
|
||||||
|
worker-type:
|
||||||
|
by-variant:
|
||||||
|
(nightly|nightly-legacy|production):
|
||||||
|
by-level:
|
||||||
|
'3': signing
|
||||||
|
default: dep-signing
|
||||||
|
default: dep-signing
|
||||||
|
worker:
|
||||||
|
signing-type:
|
||||||
|
by-variant:
|
||||||
|
(nightly|nightly-legacy|production):
|
||||||
|
by-level:
|
||||||
|
'3': release-signing
|
||||||
|
default: dep-signing
|
||||||
|
default: dep-signing
|
||||||
|
run-on-tasks-for: []
|
||||||
|
treeherder:
|
||||||
|
kind: build
|
||||||
|
tier: 2
|
||||||
|
platform: android-all/opt
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
performance-test:
|
||||||
|
attributes:
|
||||||
|
build-type: performance-test
|
||||||
|
worker-type: dep-signing
|
||||||
|
dependencies:
|
||||||
|
build: 'assemble: geckoNightlyForPerformanceTest' # comes from the old-decision task
|
||||||
|
treeherder:
|
||||||
|
symbol: forPerformanceTest(s)
|
||||||
|
|
||||||
|
production:
|
||||||
|
attributes:
|
||||||
|
build-type: production
|
||||||
|
dependencies:
|
||||||
|
build: 'Build FenixProduction task' # comes from the old-decision task
|
||||||
|
run-on-tasks-for: [github-release]
|
||||||
|
treeherder:
|
||||||
|
symbol: production(s)
|
||||||
|
|
||||||
|
nightly:
|
||||||
|
attributes:
|
||||||
|
build-type: nightly
|
||||||
|
nightly: true
|
||||||
|
dependencies:
|
||||||
|
build: 'Build FenixNightly task' # comes from the old-decision task
|
||||||
|
treeherder:
|
||||||
|
symbol: nightly(s)
|
||||||
|
|
||||||
|
nightly-legacy:
|
||||||
|
attributes:
|
||||||
|
build-type: nightly-legacy
|
||||||
|
nightly: true
|
||||||
|
dependencies:
|
||||||
|
build: 'Build FenixNightlyLegacy task' # comes from the old-decision task
|
||||||
|
treeherder:
|
||||||
|
symbol: nightly-legacy(s)
|
@ -0,0 +1,52 @@
|
|||||||
|
# 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 __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
import copy
|
||||||
|
|
||||||
|
from voluptuous import Required
|
||||||
|
|
||||||
|
from taskgraph.task import Task
|
||||||
|
from taskgraph.util.schema import Schema
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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_attributes = config.get("only-for-attributes")
|
||||||
|
only_build_type = config.get('only-for-build-types')
|
||||||
|
job_template = config.get("job-template")
|
||||||
|
|
||||||
|
for task in loaded_tasks:
|
||||||
|
if task.kind not in config.get("kind-dependencies", []):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if only_attributes:
|
||||||
|
config_attrs = set(only_attributes)
|
||||||
|
if not config_attrs & set(task.attributes):
|
||||||
|
# make sure any attribute exists
|
||||||
|
continue
|
||||||
|
|
||||||
|
if only_build_type:
|
||||||
|
build_type = task.attributes.get('build-type')
|
||||||
|
if build_type not in only_build_type:
|
||||||
|
continue
|
||||||
|
|
||||||
|
job = {"primary-dependency": task}
|
||||||
|
|
||||||
|
if job_template:
|
||||||
|
job.update(copy.deepcopy(job_template))
|
||||||
|
|
||||||
|
yield job
|
@ -0,0 +1,64 @@
|
|||||||
|
# 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/.
|
||||||
|
"""
|
||||||
|
Apply some defaults and minor modifications to the jobs defined in the build
|
||||||
|
kind.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
from taskgraph.transforms.base import TransformSequence
|
||||||
|
from taskgraph.util.schema import resolve_keyed_by
|
||||||
|
|
||||||
|
|
||||||
|
transforms = TransformSequence()
|
||||||
|
|
||||||
|
# TODO remove this transform once build tasks are migrated to taskgraph
|
||||||
|
@transforms.add
|
||||||
|
def fetch_old_decision_dependency(config, tasks):
|
||||||
|
for task in tasks:
|
||||||
|
for dep_task in config.kind_dependencies_tasks:
|
||||||
|
expected_signing_dep_label = task['dependencies']['build']
|
||||||
|
if dep_task.label != expected_signing_dep_label:
|
||||||
|
continue
|
||||||
|
|
||||||
|
task['primary-dependency'] = dep_task
|
||||||
|
yield task
|
||||||
|
|
||||||
|
|
||||||
|
@transforms.add
|
||||||
|
def define_signing_flags(config, tasks):
|
||||||
|
for task in tasks:
|
||||||
|
dep = task["primary-dependency"]
|
||||||
|
# Current kind will be prepended later in the transform chain.
|
||||||
|
task.setdefault("attributes", {}).update(dep.attributes.copy())
|
||||||
|
task["attributes"]["signed"] = True
|
||||||
|
if "run_on_tasks_for" in task["attributes"]:
|
||||||
|
task["run-on-tasks-for"] = task["attributes"]["run_on_tasks_for"]
|
||||||
|
|
||||||
|
for key in ("worker-type", "worker.signing-type"):
|
||||||
|
resolve_keyed_by(
|
||||||
|
task,
|
||||||
|
key,
|
||||||
|
item_name=task["name"],
|
||||||
|
variant=task["attributes"]["build-type"],
|
||||||
|
level=config.params["level"],
|
||||||
|
)
|
||||||
|
yield task
|
||||||
|
|
||||||
|
|
||||||
|
@transforms.add
|
||||||
|
def build_signing_task(config, tasks):
|
||||||
|
for task in tasks:
|
||||||
|
dep = task.pop("primary-dependency")
|
||||||
|
task["dependencies"] = {"build": dep.label}
|
||||||
|
task["worker"]["upstream-artifacts"] = [
|
||||||
|
{
|
||||||
|
"taskId": {"task-reference": "<build>"},
|
||||||
|
"taskType": "build",
|
||||||
|
"paths": dep.attributes["apks"].values(),
|
||||||
|
"formats": ["autograph_apk"],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
yield task
|
Loading…
Reference in New Issue