1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 from taskgraph
.parameters
import extend_parameters_schema
9 from voluptuous
import Any
, Optional
, Required
11 from gecko_taskgraph
import GECKO
12 from gecko_taskgraph
.files_changed
import get_locally_changed_files
14 logger
= logging
.getLogger(__name__
)
17 gecko_parameters_schema
= {
18 Required("app_version"): str,
19 Required("backstop"): bool,
20 Required("build_number"): int,
21 Required("enable_always_target"): Any(bool, [str]),
22 Required("files_changed"): [str],
23 Required("hg_branch"): str,
24 Required("message"): str,
25 Required("next_version"): Any(None, str),
26 Required("optimize_strategies"): Any(None, str),
27 Required("phabricator_diff"): Any(None, str),
28 Required("release_enable_emefree"): bool,
29 Required("release_enable_partner_repack"): bool,
30 Required("release_enable_partner_attribution"): bool,
31 Required("release_eta"): Any(None, str),
32 Required("release_history"): {str: dict},
33 Required("release_partners"): Any(None, [str]),
34 Required("release_partner_config"): Any(None, dict),
35 Required("release_partner_build_number"): int,
36 Required("release_type"): str,
37 Required("release_product"): Any(None, str),
38 Required("required_signoffs"): [str],
39 Required("signoff_urls"): dict,
40 Required("test_manifest_loader"): str,
41 Required("try_mode"): Any(None, str),
42 Required("try_options"): Any(None, dict),
43 Required("try_task_config"): {
44 Optional("tasks"): [str],
45 Optional("browsertime"): bool,
46 Optional("chemspill-prio"): bool,
47 Optional("disable-pgo"): bool,
48 Optional("env"): {str: str},
49 Optional("gecko-profile"): bool,
50 Optional("gecko-profile-interval"): float,
51 Optional("gecko-profile-entries"): int,
52 Optional("gecko-profile-features"): str,
53 Optional("gecko-profile-threads"): str,
56 description
="adjust parameters, chunks, etc. to speed up the process "
57 "of greening up a new test config.",
61 description
="Options passed from `mach perftest` to try.",
64 "optimize-strategies",
65 description
="Alternative optimization strategies to use instead of the default. "
66 "A module path pointing to a dict to be use as the `strategy_override` "
67 "argument in `taskgraph.optimize.base.optimize_task_graph`.",
69 Optional("rebuild"): int,
70 Optional("tasks-regex"): {
71 "include": Any(None, [str]),
72 "exclude": Any(None, [str]),
74 Optional("use-artifact-builds"): bool,
77 description
="Mapping of worker alias to worker pools to use for those aliases.",
81 description
="List of worker types that we will use to run tasks on.",
83 Optional("routes"): [str],
85 Required("version"): str,
89 def get_contents(path
):
90 with
open(path
, "r") as fh
:
91 contents
= fh
.readline().rstrip()
95 def get_version(product_dir
="browser"):
96 version_path
= os
.path
.join(GECKO
, product_dir
, "config", "version_display.txt")
97 return get_contents(version_path
)
100 def get_app_version(product_dir
="browser"):
101 app_version_path
= os
.path
.join(GECKO
, product_dir
, "config", "version.txt")
102 return get_contents(app_version_path
)
105 def get_defaults(repo_root
=None):
107 "app_version": get_app_version(),
109 "base_repository": "https://hg.mozilla.org/mozilla-unified",
111 "enable_always_target": ["docker-image"],
112 "files_changed": sorted(get_locally_changed_files(repo_root
)),
113 "head_repository": "https://hg.mozilla.org/mozilla-central",
114 "hg_branch": "default",
116 "next_version": None,
117 "optimize_strategies": None,
118 "phabricator_diff": None,
119 "project": "mozilla-central",
120 "release_enable_emefree": False,
121 "release_enable_partner_repack": False,
122 "release_enable_partner_attribution": False,
124 "release_history": {},
125 "release_partners": [],
126 "release_partner_config": None,
127 "release_partner_build_number": 1,
128 "release_product": None,
129 "release_type": "nightly",
130 # This refers to the upstream repo rather than the local checkout, so
131 # should be hardcoded to 'hg' even with git-cinnabar.
132 "repository_type": "hg",
133 "required_signoffs": [],
135 "test_manifest_loader": "default",
138 "try_task_config": {},
139 "version": get_version(),
143 def register_parameters():
144 extend_parameters_schema(gecko_parameters_schema
, defaults_fn
=get_defaults
)