Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back out "feat(caches): support opting into or out of specific name c… #627

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/taskgraph/transforms/run/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import hashlib
import json
import re

from taskgraph.util.taskcluster import get_artifact_prefix

Expand All @@ -32,11 +31,7 @@ def add_cache(task, taskdesc, name, mount_point, skip_untrusted=False):
skip_untrusted (bool): Whether cache is used in untrusted environments
(default: False). Only applies to docker-worker.
"""
use_caches = task["run"].get("use-caches", True)
if isinstance(use_caches, list):
use_caches = any(re.match(pattern, name) for pattern in use_caches)

if not use_caches:
if not task["run"].get("use-caches", True):
return

worker = task["worker"]
Expand Down
6 changes: 2 additions & 4 deletions src/taskgraph/transforms/run/run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
# tend to hide their caches. This cache is never added for level-1 tasks.
# TODO Once bug 1526028 is fixed, this and 'use-caches' should be merged.
Required("cache-dotcache"): bool,
# Whether or not to use caches. If a boolean, all caches will be
# enabled or disabled. If a list, entries are regexes. Only cache names
# that match one of the listed regexes are enabled.
Optional("use-caches"): Any(bool, [str]),
# Whether or not to use caches.
Optional("use-caches"): bool,
# if true (the default), perform a checkout on the worker
Required("checkout"): Any(bool, {str: dict}),
Optional(
Expand Down
12 changes: 0 additions & 12 deletions test/test_transforms_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,6 @@ def test_caches_generic_worker(run_caches):
]


def test_caches_regex(run_caches):
task = {
"run": {
"use-caches": ["cache[^1]"],
},
"worker-type": "t-win",
}
caches = run_caches(task)
assert len(caches) == 1
assert caches[0]["cache-name"] == "cache2"


@pytest.mark.parametrize("worker_type", ("t-linux", "t-win"))
def test_caches_disabled(run_caches, worker_type):
assert (
Expand Down
Loading