Skip to content

Commit 7f731f6

Browse files
authored
Merge pull request #691 from jcristau/revert-gw-run-task-mount
Revert "Let generic-worker verify run-task/fetch-content integrity"
2 parents dba0375 + 4f834ea commit 7f731f6

File tree

4 files changed

+7
-37
lines changed

4 files changed

+7
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
### Fixed
66

7-
- regression in 14.2.0 causing schema validation failure for generic-worker
8-
tasks using run-task (#688)
7+
- Revert "generic-worker will now verify run-task/fetch-content integrity" from
8+
14.2.0 for being broken
99

1010
## [14.2.0] - 2025-05-12
1111

src/taskgraph/transforms/run/run_task.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"""
77

88
import dataclasses
9-
import hashlib
109
import os
11-
from pathlib import Path
1210

1311
from voluptuous import Any, Optional, Required
1412

@@ -27,9 +25,6 @@
2725
"powershell": ["powershell.exe", "-ExecutionPolicy", "Bypass"],
2826
}
2927

30-
RUN_TASK_PATH = Path(__file__).parent.parent.parent / "run-task" / "run-task"
31-
FETCH_CONTENT_PATH = Path(__file__).parent.parent.parent / "run-task" / "fetch-content"
32-
3328
run_task_schema = Schema(
3429
{
3530
Required("using"): "run-task",
@@ -174,14 +169,10 @@ def generic_worker_run_task(config, task, taskdesc):
174169
common_setup(config, task, taskdesc, command)
175170

176171
worker.setdefault("mounts", [])
177-
run_task_sha256 = hashlib.sha256(RUN_TASK_PATH.read_bytes()).hexdigest()
178-
fetch_content_sha256 = hashlib.sha256(FETCH_CONTENT_PATH.read_bytes()).hexdigest()
179172
worker["mounts"].append(
180173
{
181174
"content": {
182-
"task-id": {"task-reference": "<decision>"},
183-
"artifact": "public/run-task",
184-
"sha256": run_task_sha256,
175+
"url": script_url(config, "run-task"),
185176
},
186177
"file": "./run-task",
187178
}
@@ -190,9 +181,7 @@ def generic_worker_run_task(config, task, taskdesc):
190181
worker["mounts"].append(
191182
{
192183
"content": {
193-
"task-id": {"task-reference": "<decision>"},
194-
"artifact": "public/fetch-content",
195-
"sha256": fetch_content_sha256,
184+
"url": script_url(config, "fetch-content"),
196185
},
197186
"file": "./fetch-content",
198187
}

src/taskgraph/transforms/task.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,6 @@ 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,
627625
},
628626
# *** Either file or directory must be specified. ***
629627
# If mounting a cache or read-only directory, the filesystem location of

test/test_transforms_run_run_task.py

Lines changed: 3 additions & 20 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, set_defaults
11+
from taskgraph.transforms.task import payload_builders
1212
from taskgraph.util.caches import CACHES
1313
from taskgraph.util.schema import Schema, validate_schema
1414
from taskgraph.util.templates import merge
@@ -70,7 +70,6 @@ def assert_docker_worker(task):
7070
"-cx",
7171
"echo hello world",
7272
],
73-
"docker-image": {"in-tree": "image"},
7473
"env": {
7574
"CI_BASE_REPOSITORY": "http://hg.example.com",
7675
"CI_HEAD_REF": "default",
@@ -88,13 +87,6 @@ def assert_docker_worker(task):
8887
},
8988
"worker-type": "t-linux",
9089
}
91-
taskdesc = next(set_defaults({}, [task]))
92-
taskdesc["worker"]["max-run-time"] = 0
93-
validate_schema(
94-
payload_builders[taskdesc["worker"]["implementation"]].schema,
95-
taskdesc["worker"],
96-
"validation error",
97-
)
9890

9991

10092
def assert_generic_worker(task):
@@ -129,9 +121,7 @@ def assert_generic_worker(task):
129121
{"cache-name": "checkouts", "directory": "build"},
130122
{
131123
"content": {
132-
"artifact": "public/run-task",
133-
"sha256": "581ca6876fac84fa2dd8e8c2c18677d790890e9675229fd34c912c937ae19fae",
134-
"task-id": {"task-reference": "<decision>"},
124+
"url": "https://tc-tests.localhost/api/queue/v1/task/<TASK_ID>/artifacts/public/run-task"
135125
},
136126
"file": "./run-task",
137127
},
@@ -140,13 +130,6 @@ def assert_generic_worker(task):
140130
},
141131
"worker-type": "b-win2012",
142132
}
143-
taskdesc = next(set_defaults({}, [task]))
144-
taskdesc["worker"]["max-run-time"] = 0
145-
validate_schema(
146-
payload_builders[taskdesc["worker"]["implementation"]].schema,
147-
taskdesc["worker"],
148-
"validation error",
149-
)
150133

151134

152135
def assert_exec_with(task):
@@ -192,7 +175,7 @@ def assert_run_task_command_generic_worker(task):
192175
"task",
193176
(
194177
pytest.param(
195-
{"worker": {"os": "linux", "docker-image": {"in-tree": "image"}}},
178+
{"worker": {"os": "linux"}},
196179
id="docker_worker",
197180
),
198181
pytest.param(

0 commit comments

Comments
 (0)