Skip to content

Commit e9fb295

Browse files
committed
Add conditional taskclusterProxy and scopes for docker-image tasks
1 parent 625b82a commit e9fb295

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/taskgraph/transforms/docker_image.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
from taskgraph.transforms.base import TransformSequence
1414
from taskgraph.util import json
1515
from taskgraph.util.docker import create_context_tar, generate_context_hash
16-
from taskgraph.util.taskcluster import get_artifact_prefix_from_parameters
1716
from taskgraph.util.schema import Schema
17+
from taskgraph.util.taskcluster import (
18+
get_artifact_prefix_from_parameters,
19+
is_public_artifact_prefix,
20+
)
1821

1922
from .task import task_description_schema
2023

@@ -192,7 +195,9 @@ def fill_template(config, tasks):
192195
},
193196
"always-target": True,
194197
"expires-after": expires if config.params.is_try() else "1 year",
195-
"scopes": [],
198+
"scopes": []
199+
if is_public_artifact_prefix(config.params)
200+
else [f"queue:get-artifact:{artifact_prefix}/docker-contexts/*.tar.gz"],
196201
"run-on-projects": [],
197202
"worker-type": "images",
198203
"worker": {
@@ -224,6 +229,9 @@ def fill_template(config, tasks):
224229
"max-run-time": 7200,
225230
},
226231
}
232+
233+
if not is_public_artifact_prefix(config.params):
234+
taskdesc["worker"]["features"] = {"taskclusterProxy": True}
227235
if "index" in task:
228236
taskdesc["index"] = task["index"]
229237
if job_symbol:

src/taskgraph/util/taskcluster.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ def get_artifact_prefix_from_parameters(parameters):
165165
return parameters.get("artifact_prefix", "public")
166166

167167

168+
def is_public_artifact_prefix(parameters):
169+
return get_artifact_prefix_from_parameters(parameters) == "public"
170+
171+
168172
def get_artifact_with_prefix(task_id, path, parameters, use_proxy=False):
169173
prefix = get_artifact_prefix_from_parameters(parameters)
170174
prefixed_path = f"{prefix}/{path}"

0 commit comments

Comments
 (0)