Skip to content

Commit d40eb17

Browse files
committed
fix(load-task): use feature detection rather than worker-implementation
Previously we were checking whether the worker-implementation was docker-worker by looking at the task tags. But many projects are missing this tag, and especially Decision tasks don't tend to have it. Instead, check if the `payload.image` key is defined.
1 parent 7224528 commit d40eb17

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/taskgraph/docker.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,8 @@ def load_task(task_id, remove=True, user=None):
269269
user = user or "worker"
270270
task_def = get_task_definition(task_id)
271271

272-
if (
273-
impl := task_def.get("tags", {}).get("worker-implementation")
274-
) != "docker-worker":
275-
print(f"Tasks with worker-implementation '{impl}' are not supported!")
272+
if "payload" not in task_def or not (image := task_def["payload"].get("image")):
273+
print("Tasks without a `payload.image` are not supported!")
276274
return 1
277275

278276
command = task_def["payload"].get("command")
@@ -308,7 +306,7 @@ def load_task(task_id, remove=True, user=None):
308306
else:
309307
task_cwd = "$TASK_WORKDIR"
310308

311-
image_task_id = task_def["payload"]["image"]["taskId"]
309+
image_task_id = image["taskId"]
312310
image_tag = load_image_by_task_id(image_task_id)
313311

314312
# Set some env vars the worker would normally set.

0 commit comments

Comments
 (0)