Skip to content

Commit 03138d7

Browse files
committed
Add conditional taskclusterProxy and scopes for docker-image tasks
1 parent 1f6c54c commit 03138d7

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/taskgraph/transforms/docker_image.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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
16+
from taskgraph.util.taskcluster import get_artifact_prefix_from_parameters, is_public_artifact_prefix
1717
from taskgraph.util.schema import Schema
1818

1919
from .task import task_description_schema
@@ -192,7 +192,9 @@ def fill_template(config, tasks):
192192
},
193193
"always-target": True,
194194
"expires-after": expires if config.params.is_try() else "1 year",
195-
"scopes": [],
195+
"scopes": [] if is_public_artifact_prefix(config.params) else [
196+
f"queue:get-artifact:{artifact_prefix}/docker-contexts/*.tar.gz"
197+
],
196198
"run-on-projects": [],
197199
"worker-type": "images",
198200
"worker": {
@@ -224,6 +226,11 @@ def fill_template(config, tasks):
224226
"max-run-time": 7200,
225227
},
226228
}
229+
230+
if not is_public_artifact_prefix(config.params):
231+
taskdesc["worker"]["features"] = {
232+
"taskclusterProxy": True
233+
}
227234
if "index" in task:
228235
taskdesc["index"] = task["index"]
229236
if job_symbol:

src/taskgraph/util/taskcluster.py

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

194194

195+
def is_public_artifact_prefix(parameters):
196+
return get_artifact_prefix_from_parameters(parameters) == "public"
197+
198+
195199
def get_artifact_with_prefix(task_id, path, parameters, use_proxy=False):
196200
prefix = get_artifact_prefix_from_parameters(parameters)
197201
prefixed_path = f"{prefix}/{path}"

0 commit comments

Comments
 (0)