tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 1cb805ff3339b686c0741b39cd05c22cf14eaa5f
parent 1727e353f289c0c2f47090fcc14d340c7e5e8837
Author: Andrew Halberstadt <ahal@mozilla.com>
Date:   Fri, 31 Oct 2025 13:32:03 +0000

Bug 1996667 - Use separate checkout cache names for tasks cloning Git, r=taskgraph-reviewers,jcristau

Differential Revision: https://phabricator.services.mozilla.com/D270346

Diffstat:
Mtaskcluster/gecko_taskgraph/transforms/job/common.py | 30++++++++++++++++++++----------
Mtaskcluster/gecko_taskgraph/transforms/job/run_task.py | 2+-
Mtaskcluster/gecko_taskgraph/transforms/task.py | 17+++++++++++++++++
3 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/taskcluster/gecko_taskgraph/transforms/job/common.py b/taskcluster/gecko_taskgraph/transforms/job/common.py @@ -45,16 +45,26 @@ def generic_worker_add_artifacts(config, job, taskdesc): def get_cache_name(config, job): cache_name = "checkouts" - # Sparse checkouts need their own cache because they can interfere - # with clients that aren't sparse aware. - if job["run"]["sparse-profile"]: - cache_name += "-sparse" - - # Workers using Mercurial >= 5.8 will enable revlog-compression-zstd, which - # workers using older versions can't understand, so they can't share cache. - # At the moment, only docker workers use the newer version. - if job["worker"]["implementation"] == "docker-worker": - cache_name += "-hg58" + if config.params["repository_type"] == "git": + # Ensure tasks cloning git don't try to use an hg cache or vice versa. + cache_name += "-git" + + # Shallow clones need their own cache because they can interfere with + # tasks that aren't expecting a shallow clone. + if job["run"].get("shallow-clone", True): + cache_name += "-shallow" + + else: + # Sparse checkouts need their own cache because they can interfere with + # clients that aren't sparse aware. + if job["run"]["sparse-profile"]: + cache_name += "-sparse" + + # Workers using Mercurial >= 5.8 will enable revlog-compression-zstd, which + # workers using older versions can't understand, so they can't share cache. + # At the moment, only docker workers use the newer version. + if job["worker"]["implementation"] == "docker-worker": + cache_name += "-hg58" return cache_name diff --git a/taskcluster/gecko_taskgraph/transforms/job/run_task.py b/taskcluster/gecko_taskgraph/transforms/job/run_task.py @@ -90,7 +90,7 @@ def common_setup(config, job, taskdesc, command): ) ) - if run["sparse-profile"]: + if config.params["repository_type"] == "hg" and run["sparse-profile"]: sparse_profile_prefix = run.pop( "sparse-profile-prefix", "build/sparse-profiles" ) diff --git a/taskcluster/gecko_taskgraph/transforms/task.py b/taskcluster/gecko_taskgraph/transforms/task.py @@ -2558,6 +2558,7 @@ def check_run_task_caches(config, tasks): ) re_sparse_checkout_cache = re.compile("^checkouts-sparse") + re_shallow_checkout_cache = re.compile("^checkouts-git-shallow") cache_prefix = "{trust_domain}-level-{level}-".format( trust_domain=config.graph_config["trust-domain"], @@ -2574,7 +2575,9 @@ def check_run_task_caches(config, tasks): run_task = is_run_task(main_command) require_sparse_cache = False + require_shallow_cache = False have_sparse_cache = False + have_shallow_cache = False if run_task: for arg in command[1:]: @@ -2601,6 +2604,10 @@ def check_run_task_caches(config, tasks): require_sparse_cache = True break + if arg == "--gecko-shallow-clone": + require_shallow_cache = True + break + for cache in payload.get("cache", {}): if not cache.startswith(cache_prefix): raise Exception( @@ -2615,6 +2622,9 @@ def check_run_task_caches(config, tasks): if re_sparse_checkout_cache.match(cache): have_sparse_cache = True + if re_shallow_checkout_cache.match(cache): + have_shallow_cache = True + if not re_reserved_caches.match(cache): continue @@ -2640,4 +2650,11 @@ def check_run_task_caches(config, tasks): "cache name so it is sparse aware" % task["label"] ) + if require_shallow_cache and not have_shallow_cache: + raise Exception( + "%s is using a shallow clone but not using " + "a shallow checkout cache; change the checkout " + "cache name so it is shallow aware" % task["label"] + ) + yield task