From 7b18977f5758d53356eff447cf07590b2e8a3ed7 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Wed, 15 Jan 2025 10:10:24 -0500 Subject: [PATCH] Back out "feat(caches): support opting into or out of specific name caches" This backs out commit a70a57c72c794d992075548eefc03755e387c9f1. 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. --- src/taskgraph/transforms/run/common.py | 7 +------ src/taskgraph/transforms/run/run_task.py | 6 ++---- test/test_transforms_run.py | 12 ------------ 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/taskgraph/transforms/run/common.py b/src/taskgraph/transforms/run/common.py index 450bf52fe..37095a356 100644 --- a/src/taskgraph/transforms/run/common.py +++ b/src/taskgraph/transforms/run/common.py @@ -9,7 +9,6 @@ import hashlib import json -import re from taskgraph.util.taskcluster import get_artifact_prefix @@ -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"] diff --git a/src/taskgraph/transforms/run/run_task.py b/src/taskgraph/transforms/run/run_task.py index 417c2c1cf..f0b48c3f6 100644 --- a/src/taskgraph/transforms/run/run_task.py +++ b/src/taskgraph/transforms/run/run_task.py @@ -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( diff --git a/test/test_transforms_run.py b/test/test_transforms_run.py index 3e851be6a..ee36e9ee2 100644 --- a/test/test_transforms_run.py +++ b/test/test_transforms_run.py @@ -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 (