Skip to content

Commit d33455f

Browse files
committed
Fix run-task/fetch-content mounts definition
Fixes a regression from #666, which: - used taskId instead of task-id in the task description - failed to add sha256 to the schema
1 parent e34fb71 commit d33455f

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

src/taskgraph/transforms/run/run_task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def generic_worker_run_task(config, task, taskdesc):
179179
worker["mounts"].append(
180180
{
181181
"content": {
182-
"taskId": {"task-reference": "<decision>"},
182+
"task-id": {"task-reference": "<decision>"},
183183
"artifact": "public/run-task",
184184
"sha256": run_task_sha256,
185185
},
@@ -190,7 +190,7 @@ def generic_worker_run_task(config, task, taskdesc):
190190
worker["mounts"].append(
191191
{
192192
"content": {
193-
"taskId": {"task-reference": "<decision>"},
193+
"task-id": {"task-reference": "<decision>"},
194194
"artifact": "public/fetch-content",
195195
"sha256": fetch_content_sha256,
196196
},

src/taskgraph/transforms/task.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ def build_docker_worker_payload(config, task, task_def):
622622
# URL that supplies the content in response to an unauthenticated
623623
# GET request.
624624
Optional("url"): str,
625+
# SHA256 checksum of the content body
626+
Optional("sha256"): str,
625627
},
626628
# *** Either file or directory must be specified. ***
627629
# If mounting a cache or read-only directory, the filesystem location of

test/test_transforms_run_run_task.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99

1010
from taskgraph.transforms.run import make_task_description
11-
from taskgraph.transforms.task import payload_builders
11+
from taskgraph.transforms.task import payload_builders, set_defaults
1212
from taskgraph.util.caches import CACHES
1313
from taskgraph.util.schema import Schema, validate_schema
1414
from taskgraph.util.templates import merge
@@ -70,6 +70,7 @@ def assert_docker_worker(task):
7070
"-cx",
7171
"echo hello world",
7272
],
73+
"docker-image": {"in-tree": "image"},
7374
"env": {
7475
"CI_BASE_REPOSITORY": "http://hg.example.com",
7576
"CI_HEAD_REF": "default",
@@ -87,6 +88,10 @@ def assert_docker_worker(task):
8788
},
8889
"worker-type": "t-linux",
8990
}
91+
taskdesc = next(set_defaults({}, [task]))
92+
taskdesc["worker"]["max-run-time"] = 0
93+
validate_schema(payload_builders[taskdesc["worker"]["implementation"]].schema,
94+
taskdesc["worker"], "validation error")
9095

9196

9297
def assert_generic_worker(task):
@@ -123,7 +128,7 @@ def assert_generic_worker(task):
123128
"content": {
124129
"artifact": "public/run-task",
125130
"sha256": "581ca6876fac84fa2dd8e8c2c18677d790890e9675229fd34c912c937ae19fae",
126-
"taskId": {"task-reference": "<decision>"},
131+
"task-id": {"task-reference": "<decision>"},
127132
},
128133
"file": "./run-task",
129134
},
@@ -132,6 +137,10 @@ def assert_generic_worker(task):
132137
},
133138
"worker-type": "b-win2012",
134139
}
140+
taskdesc = next(set_defaults({}, [task]))
141+
taskdesc["worker"]["max-run-time"] = 0
142+
validate_schema(payload_builders[taskdesc["worker"]["implementation"]].schema,
143+
taskdesc["worker"], "validation error")
135144

136145

137146
def assert_exec_with(task):
@@ -177,7 +186,7 @@ def assert_run_task_command_generic_worker(task):
177186
"task",
178187
(
179188
pytest.param(
180-
{"worker": {"os": "linux"}},
189+
{"worker": {"os": "linux", "docker-image": {"in-tree": "image"}}},
181190
id="docker_worker",
182191
),
183192
pytest.param(

0 commit comments

Comments
 (0)