Skip to content

Commit

Permalink
Back out "feat(caches): support opting into or out of specific name c…
Browse files Browse the repository at this point in the history
…aches"

This backs out commit a70a57c.

For context I should have held off landing this as I ended up deciding
that it was better to have well defined caches that need to be opted
into explicitly.

I want to avoid having a release with this regex feature to ensure we
don't have users accidentally using it and then needing to stop using it
on the next release.
  • Loading branch information
ahal committed Jan 15, 2025
1 parent 3001078 commit 15ff22c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
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

0 comments on commit 15ff22c

Please sign in to comment.