Skip to content

Commit 9917abe

Browse files
committed
landing_worker: update try_task_config.json (bug 2013005) r=sheehan
Pull request: #882
1 parent b1705f9 commit 9917abe

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/lando/api/legacy/workers/landing_worker.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ def add_try_task_config(self, scm: AbstractSCM, **github_params):
182182
NOTE: try_task_config value will be a copy of provided github_params
183183
with keys prepended with "github_".
184184
"""
185-
allowed_params = (
185+
required_params = {
186186
"pull_number",
187187
"pull_head_sha",
188188
"repo_url",
189189
"branch",
190-
)
191-
if not set(github_params).issubset(allowed_params):
190+
}
191+
if set(github_params) != required_params:
192192
raise ValueError(
193-
"Disallowed parameter(s) passed: "
194-
f"{set(allowed_params).difference(github_params)}"
193+
"Missing or disallowed parameter(s) passed: "
194+
f"{required_params.symmetric_difference(github_params)}"
195195
)
196196

197197
with (Path(scm.path) / "try_task_config.json").open("x") as f:
@@ -201,7 +201,7 @@ def add_try_task_config(self, scm: AbstractSCM, **github_params):
201201
"target_tasks_method": "codereview",
202202
"try_mode": "try_task_config",
203203
"try_task_config": {
204-
f"github_{k}": v for k, v in github_params.items()
204+
"github": github_params,
205205
},
206206
},
207207
"version": 2,

src/lando/api/tests/test_landings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
--- /dev/null
285285
+++ b/try_task_config.json
286286
@@ -0,0 +1 @@
287-
+{{"parameters": {{"optimize_target_tasks": true, "target_tasks_method": "codereview", "try_mode": "try_task_config", "try_task_config": {{"github_pull_number": 1, "github_pull_head_sha": null, "github_repo_url": "{}", "github_branch": "main"}}}}, "version": 2}}
287+
+{{"parameters": {{"optimize_target_tasks": true, "target_tasks_method": "codereview", "try_mode": "try_task_config", "try_task_config": {{"github": {{"pull_number": 1, "pull_head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "repo_url": "{}", "branch": "main"}}}}}}, "version": 2}}
288288
\\ No newline at end of file
289289
""".lstrip()
290290

@@ -1355,6 +1355,7 @@ def make_handover_job(
13551355
def _make_handover_job(target_repo: Repo, handover_repo: Repo) -> LandingJob:
13561356
revision = create_patch_revision(1)
13571357
revision.pull_number = 1
1358+
revision.pull_head_sha = "a" * 40
13581359
revision.patches = revision.patch
13591360
revision.patch_data = {
13601361
"author_name": "someone",

0 commit comments

Comments
 (0)