Skip to content

Commit

Permalink
refactor!: default to only use the 'checkout' cache
Browse files Browse the repository at this point in the history
We shouldn't set up a cache for every conceivable tool that's going to
be added to the `CACHES` config. Instead tasks should list out the ones
they need.

The checkout cache is going to be pretty standard and is a reasonable
default.
  • Loading branch information
ahal committed Jan 20, 2025
1 parent cda7368 commit 2bd5762
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 49 deletions.
2 changes: 1 addition & 1 deletion src/taskgraph/transforms/run/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def support_caches(
use_caches = (
config.graph_config.get("taskgraph", {})
.get("run", {})
.get("use-caches", True)
.get("use-caches", ["checkout"])
)

for name, cache_cfg in CACHES.items():
Expand Down
48 changes: 0 additions & 48 deletions test/test_transforms_run_run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,36 +55,12 @@ def assert_docker_worker(task):
"soft-dependencies": [],
"worker": {
"caches": [
{
'mount-point': '/builds/worker/.task-cache/cargo',
'name': 'cargo',
'skip-untrusted': False,
'type': 'persistent',
},
{
"mount-point": "/builds/worker/checkouts",
"name": "checkouts",
"skip-untrusted": False,
"type": "persistent",
},
{
'mount-point': '/builds/worker/.task-cache/npm',
'name': 'npm',
'skip-untrusted': False,
'type': 'persistent',
},
{
'mount-point': '/builds/worker/.task-cache/pip',
'name': 'pip',
'skip-untrusted': False,
'type': 'persistent',
},
{
'mount-point': '/builds/worker/.task-cache/uv',
'name': 'uv',
'skip-untrusted': False,
'type': 'persistent',
},
],
"command": [
"/usr/local/bin/run-task",
Expand All @@ -95,19 +71,15 @@ def assert_docker_worker(task):
"echo hello world",
],
"env": {
"CARGO_HOME": "/builds/worker/.task-cache/cargo",
"CI_BASE_REPOSITORY": "http://hg.example.com",
"CI_HEAD_REF": "default",
"CI_HEAD_REPOSITORY": "http://hg.example.com",
"CI_HEAD_REV": "abcdef",
"CI_REPOSITORY_TYPE": "hg",
"HG_STORE_PATH": "/builds/worker/checkouts/hg-store",
"MOZ_SCM_LEVEL": "1",
"PIP_CACHE_DIR": "/builds/worker/.task-cache/pip",
"REPOSITORIES": '{"ci": "Taskgraph"}',
"UV_CACHE_DIR": "/builds/worker/.task-cache/uv",
"VCS_PATH": "/builds/worker/checkouts/vcs",
"npm_config_cache": "/builds/worker/.task-cache/npm",
},
"implementation": "docker-worker",
"os": "linux",
Expand All @@ -134,39 +106,19 @@ def assert_generic_worker(task):
'world"'
],
"env": {
"CARGO_HOME": "{task_workdir}/.task-cache/cargo",
"CI_BASE_REPOSITORY": "http://hg.example.com",
"CI_HEAD_REF": "default",
"CI_HEAD_REPOSITORY": "http://hg.example.com",
"CI_HEAD_REV": "abcdef",
"CI_REPOSITORY_TYPE": "hg",
"HG_STORE_PATH": "y:/hg-shared",
"MOZ_SCM_LEVEL": "1",
"PIP_CACHE_DIR": "{task_workdir}/.task-cache/pip",
"REPOSITORIES": '{"ci": "Taskgraph"}',
"UV_CACHE_DIR": "{task_workdir}/.task-cache/uv",
"VCS_PATH": "{task_workdir}/build/src",
"npm_config_cache": "{task_workdir}/.task-cache/npm",
},
"implementation": "generic-worker",
"mounts": [
{
"cache-name": "cargo",
"directory": ".task-cache/cargo",
},
{"cache-name": "checkouts", "directory": "build"},
{
"cache-name": "npm",
"directory": ".task-cache/npm",
},
{
"cache-name": "pip",
"directory": ".task-cache/pip",
},
{
"cache-name": "uv",
"directory": ".task-cache/uv",
},
{
"content": {
"url": "https://tc-tests.localhost/api/queue/v1/task/<TASK_ID>/artifacts/public/run-task"
Expand Down

0 comments on commit 2bd5762

Please sign in to comment.