Skip to content

Commit 0dad918

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

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
@@ -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)