Skip to content

Commit 55380ba

Browse files
committed
fix: replace uses of Parameters.is_try() with level check
In the Github world, what is considered "try" or not is much less defined than it is on hgmo. Currently we have "enterprise-firefox-try", "firefox-dev" and "staging-firefox" that are all "try-like" in that they will run tasks on any arbitrary branch push. We can no longer rely on the magic string "try" being present in the repo name to determine this, and imo nor should we ever have been. At least in this repo, all uses of `is_try()` are probably better off just using `level == 1` instead. Bug: 2044330
1 parent e3fbacf commit 55380ba

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

src/taskgraph/transforms/docker_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def fill_template(config, tasks):
130130
"artifact_prefix": "public",
131131
},
132132
"always-target": True,
133-
"expires-after": expires if config.params.is_try() else "1 year",
133+
"expires-after": expires if config.params["level"] == "1" else "1 year",
134134
"scopes": [],
135135
"run-on-projects": [],
136136
"worker-type": "images",

src/taskgraph/transforms/task.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,10 @@ def build_docker_worker_payload(config, task, task_def):
457457
else:
458458
suffix = cache_version
459459

460-
skip_untrusted = config.params.is_try() or level == 1
461-
462460
for cache in worker["caches"]:
463461
# Some caches aren't enabled in environments where we can't
464462
# guarantee certain behavior. Filter those out.
465-
if cache.get("skip-untrusted") and skip_untrusted:
463+
if cache.get("skip-untrusted") and level == 1:
466464
continue
467465

468466
name = "{trust_domain}-level-{level}-{name}-{suffix}".format(
@@ -484,7 +482,7 @@ def build_docker_worker_payload(config, task, task_def):
484482
if run_task and worker.get("volumes"):
485483
payload["env"]["TASKCLUSTER_VOLUMES"] = ";".join(sorted(worker["volumes"]))
486484

487-
if payload.get("cache") and skip_untrusted: # type: ignore
485+
if payload.get("cache") and level == 1: # type: ignore
488486
payload["env"]["TASKCLUSTER_UNTRUSTED_CACHES"] = "1"
489487

490488
if features:
@@ -999,7 +997,7 @@ def build_task(config, tasks):
999997
if "expires-after" not in task:
1000998
task["expires-after"] = (
1001999
config.graph_config._config.get("task-expires-after", "28 days")
1002-
if config.params.is_try()
1000+
if config.params["level"] == "1"
10031001
else "1 year"
10041002
)
10051003

0 commit comments

Comments
 (0)