Skip to content

Commit feea40d

Browse files
committed
refactor!: remove support for hg sparse-profiles
BREAKING CHANGE: sparse profiles are no longer supported This feature isn't being used by any known Taskgraph consumers. After Gecko finishes migrating to Github, we'll be dropping support for hg.mozilla.org based repositories anyway. Cleaning this up now helps simplify the migration, and ensures we don't accidentally start depending on the feature in the meantime.
1 parent dcc7698 commit feea40d

File tree

9 files changed

+10
-56
lines changed

9 files changed

+10
-56
lines changed

docs/reference/migrations.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ Migration Guide
33

44
This page can help when migrating Taskgraph across major versions.
55

6+
17.x -> 18.x
7+
------------
8+
9+
* Stop setting the ``run.sparse-profile`` key in all tasks which perform a
10+
Mercurial clone. If sparse profiles are still required, the task must perform
11+
its own clone and not rely on the ``run-task`` script to do it.
12+
613
16.x -> 17.x
714
------------
815

src/taskgraph/run-task/run-task

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,6 @@ def hg_checkout(
824824
head_repo: str,
825825
base_repo: Optional[str],
826826
store_path: str,
827-
sparse_profile: Optional[str],
828827
branch: Optional[str],
829828
revision: Optional[str],
830829
):
@@ -849,8 +848,6 @@ def hg_checkout(
849848

850849
if base_repo:
851850
args.extend(["--upstream", base_repo])
852-
if sparse_profile:
853-
args.extend(["--sparseprofile", sparse_profile])
854851

855852
# Specify method to checkout a revision. This defaults to revisions as
856853
# SHA-1 strings, but also supports symbolic revisions like `tip` via the
@@ -914,10 +911,6 @@ def add_vcs_arguments(parser, project, name):
914911
f"--{project}-checkout",
915912
help=f"Directory where {name} checkout should be created",
916913
)
917-
parser.add_argument(
918-
f"--{project}-sparse-profile",
919-
help=f"Path to sparse profile for {name} checkout",
920-
)
921914
parser.add_argument(
922915
f"--{project}-shallow-clone",
923916
action="store_true",
@@ -927,7 +920,6 @@ def add_vcs_arguments(parser, project, name):
927920

928921
def collect_vcs_options(args, project, name):
929922
checkout = getattr(args, f"{project}_checkout")
930-
sparse_profile = getattr(args, f"{project}_sparse_profile")
931923
shallow_clone = getattr(args, f"{project}_shallow_clone")
932924

933925
env_prefix = project.upper()
@@ -964,7 +956,6 @@ def collect_vcs_options(args, project, name):
964956
"name": name,
965957
"env-prefix": env_prefix,
966958
"checkout": checkout,
967-
"sparse-profile": sparse_profile,
968959
"base-repo": base_repo,
969960
"base-rev": base_rev,
970961
"head-repo": head_repo,
@@ -1030,7 +1021,6 @@ def vcs_checkout_from_args(options):
10301021
options["head-repo"],
10311022
options["base-repo"],
10321023
options["store-path"],
1033-
options["sparse-profile"],
10341024
head_ref,
10351025
head_rev,
10361026
)

src/taskgraph/transforms/run/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def generic_worker_add_artifacts(config, task, taskdesc):
8282
add_artifacts(config, task, taskdesc, path=get_artifact_prefix(taskdesc))
8383

8484

85-
def support_vcs_checkout(config, task, taskdesc, repo_configs, sparse=False):
85+
def support_vcs_checkout(config, task, taskdesc, repo_configs):
8686
"""Update a task with parameters to enable a VCS checkout.
8787
8888
This can only be used with ``run-task`` tasks, as the cache name is

src/taskgraph/transforms/run/run_task.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@
6666
""".lstrip()
6767
),
6868
): str,
69-
Required(
70-
"sparse-profile",
71-
description=dedent(
72-
"""
73-
The sparse checkout profile to use. Value is the filename relative to the
74-
directory where sparse profiles are defined (build/sparse-profiles/).
75-
""".lstrip()
76-
),
77-
): Any(str, None),
7869
Required(
7970
"command",
8071
description=dedent(
@@ -140,21 +131,12 @@ def common_setup(config, task, taskdesc, command):
140131
task,
141132
taskdesc,
142133
repo_configs=repo_configs,
143-
sparse=bool(run["sparse-profile"]),
144134
)
145135

146136
for repo_config in repo_configs.values():
147137
checkout_path = path.join(vcs_path, repo_config.path)
148138
command.append(f"--{repo_config.prefix}-checkout={checkout_path}")
149139

150-
if run["sparse-profile"]:
151-
command.append(
152-
"--{}-sparse-profile=build/sparse-profiles/{}".format(
153-
repo_config.prefix, # type: ignore
154-
run["sparse-profile"],
155-
)
156-
)
157-
158140
if "cwd" in run:
159141
run["cwd"] = path.normpath(run["cwd"].format(checkout=vcs_path))
160142
elif "cwd" in run and "{checkout}" in run["cwd"]:
@@ -174,7 +156,6 @@ def common_setup(config, task, taskdesc, command):
174156

175157
worker_defaults = {
176158
"checkout": True,
177-
"sparse-profile": None,
178159
"run-as-root": False,
179160
}
180161

src/taskgraph/transforms/run/toolchain.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,6 @@
5050
"""
5151
),
5252
): [str],
53-
Required(
54-
"sparse-profile",
55-
description=dedent(
56-
"""
57-
Sparse profile to give to checkout using `run-task`. If given,
58-
a filename in `build/sparse-profiles`. Defaults to
59-
"toolchain-build", i.e., to
60-
`build/sparse-profiles/toolchain-build`. If `None`, instructs
61-
`run-task` to not use a sparse profile at all.
62-
"""
63-
),
64-
): Any(str, None),
6553
Optional(
6654
"resources",
6755
description=dedent(
@@ -205,9 +193,7 @@ def common_toolchain(config, task, taskdesc, is_docker):
205193
configure_taskdesc_for_run(config, task, taskdesc, worker["implementation"])
206194

207195

208-
toolchain_defaults = {
209-
"sparse-profile": "toolchain-build",
210-
}
196+
toolchain_defaults = {}
211197

212198

213199
@run_task_using(

src/taskgraph/util/caches.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ def get_checkout_cache_name(config: "TransformConfig", task: dict[str, Any]) ->
3737
digest = hashlib.sha256(checkout_paths_str).hexdigest()
3838
cache_name += f"-repos-{digest}"
3939

40-
# Sparse checkouts need their own cache because they can interfere
41-
# with clients that aren't sparse aware.
42-
if task["run"]["sparse-profile"]:
43-
cache_name += "-sparse"
44-
4540
return cache_name
4641

4742

template/{{cookiecutter.project_name}}/taskcluster.github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ tasks:
222222
ACTION_CALLBACK: '${action.cb_name}'
223223

224224
cache:
225-
"${trustDomain}-project-${project}-level-${level}-checkouts-sparse-v2": /builds/worker/checkouts
225+
"${trustDomain}-project-${project}-level-${level}-checkouts-v2": /builds/worker/checkouts
226226

227227
features:
228228
taskclusterProxy: true

test/test_scripts_run_task.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ def test_collect_vcs_options(
195195

196196
args.setdefault(f"{name}_checkout", checkout)
197197
args.setdefault(f"{name}_shallow_clone", False)
198-
args.setdefault(f"{name}_sparse_profile", False)
199198
args = Namespace(**args)
200199

201200
result = run_task_mod.collect_vcs_options(args, name, name)
@@ -214,7 +213,6 @@ def test_collect_vcs_options(
214213
"repo-type": env.get("REPOSITORY_TYPE"),
215214
"shallow-clone": False,
216215
"ssh-secret-name": env.get("SSH_SECRET_NAME"),
217-
"sparse-profile": False,
218216
"store-path": env.get("HG_STORE_PATH"),
219217
}
220218
if "PIP_REQUIREMENTS" in env:

test/test_transforms_run_toolchain.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def assert_docker_worker(task, taskdesc):
6565
"run": {
6666
"command": ["vcs/taskcluster/scripts/toolchain/run.sh"],
6767
"cwd": "{checkout}/..",
68-
"sparse-profile": "toolchain-build",
6968
"using": "run-task",
7069
"workdir": "/builds/worker",
7170
},
@@ -140,7 +139,6 @@ def assert_generic_worker(task, taskdesc):
140139
"run": {
141140
"command": "src/taskcluster/scripts/toolchain/run.sh --foo bar",
142141
"cwd": "{checkout}/..",
143-
"sparse-profile": "toolchain-build",
144142
"using": "run-task",
145143
"workdir": "/builds/worker",
146144
},
@@ -192,7 +190,6 @@ def assert_powershell(task, _):
192190
"command": "src/taskcluster/scripts/toolchain/run.ps1",
193191
"cwd": "{checkout}/..",
194192
"exec-with": "powershell",
195-
"sparse-profile": "toolchain-build",
196193
"using": "run-task",
197194
"workdir": "/builds/worker",
198195
}

0 commit comments

Comments
 (0)