Skip to content

Commit 7243b43

Browse files
authored
PYTHON-5245 Convert remaining tasks to generated config (#2255)
1 parent 6103376 commit 7243b43

File tree

4 files changed

+111
-63
lines changed

4 files changed

+111
-63
lines changed

.evergreen/config.yml

-60
Original file line numberDiff line numberDiff line change
@@ -290,63 +290,3 @@ post:
290290
- func: "upload mo artifacts"
291291
- func: "upload test results"
292292
- func: "cleanup"
293-
294-
tasks:
295-
# Wildcard task. Do you need to find out what tools are available and where?
296-
# Throw it here, and execute this task on all buildvariants
297-
- name: getdata
298-
commands:
299-
- command: subprocess.exec
300-
binary: bash
301-
type: test
302-
params:
303-
args:
304-
- src/.evergreen/scripts/run-getdata.sh
305-
306-
- name: "coverage-report"
307-
tags: ["coverage"]
308-
depends_on:
309-
# BUILD-3165: We can't use "*" (all tasks) and specify "variant".
310-
# Instead list out all coverage tasks using tags.
311-
- name: ".standalone"
312-
variant: ".coverage_tag"
313-
# Run the coverage task even if some tasks fail.
314-
status: "*"
315-
# Run the coverage task even if some tasks are not scheduled in a patch build.
316-
patch_optional: true
317-
- name: ".replica_set"
318-
variant: ".coverage_tag"
319-
status: "*"
320-
patch_optional: true
321-
- name: ".sharded_cluster"
322-
variant: ".coverage_tag"
323-
status: "*"
324-
patch_optional: true
325-
commands:
326-
- func: "download and merge coverage"
327-
328-
- name: "check-import-time"
329-
tags: ["pr"]
330-
commands:
331-
- command: subprocess.exec
332-
type: test
333-
params:
334-
binary: bash
335-
working_dir: src
336-
include_expansions_in_env: ["PYTHON_BINARY"]
337-
args:
338-
- .evergreen/scripts/check-import-time.sh
339-
- ${revision}
340-
- ${github_commit}
341-
- name: "backport-pr"
342-
allowed_requesters: ["commit"]
343-
commands:
344-
- command: subprocess.exec
345-
type: test
346-
params:
347-
binary: bash
348-
args:
349-
- ${DRIVERS_TOOLS}/.evergreen/github_app/backport-pr.sh
350-
- mongodb
351-
- mongo-python-driver
352-
- ${github_commit}

.evergreen/generated_configs/tasks.yml

+58
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,39 @@ tasks:
713713
AWS_ROLE_SESSION_NAME: test
714714
tags: [auth-aws, auth-aws-web-identity]
715715

716+
# Backport pr tests
717+
- name: backport-pr
718+
commands:
719+
- command: subprocess.exec
720+
params:
721+
binary: bash
722+
args:
723+
- ${DRIVERS_TOOLS}/.evergreen/github_app/backport-pr.sh
724+
- mongodb
725+
- mongo-python-driver
726+
- ${github_commit}
727+
working_dir: src
728+
type: test
729+
730+
# Coverage report tests
731+
- name: coverage-report
732+
commands:
733+
- func: download and merge coverage
734+
depends_on:
735+
- name: .standalone
736+
variant: .coverage_tag
737+
status: "*"
738+
patch_optional: true
739+
- name: .replica_set
740+
variant: .coverage_tag
741+
status: "*"
742+
patch_optional: true
743+
- name: .sharded_cluster
744+
variant: .coverage_tag
745+
status: "*"
746+
patch_optional: true
747+
tags: [coverage]
748+
716749
# Doctest tests
717750
- name: test-doctests
718751
commands:
@@ -776,6 +809,31 @@ tasks:
776809
- func: run tests
777810
tags: [free-threading]
778811

812+
# Getdata tests
813+
- name: getdata
814+
commands:
815+
- command: subprocess.exec
816+
params:
817+
binary: bash
818+
args:
819+
- .evergreen/scripts/run-getdata.sh
820+
working_dir: src
821+
type: test
822+
823+
# Import time tests
824+
- name: check-import-time
825+
commands:
826+
- command: subprocess.exec
827+
params:
828+
binary: bash
829+
args:
830+
- .evergreen/scripts/check-import-time.sh
831+
- ${revision}
832+
- ${github_commit}
833+
working_dir: src
834+
type: test
835+
tags: [pr]
836+
779837
# Kms tests
780838
- name: test-gcpkms
781839
commands:

.evergreen/scripts/generate_config.py

+52-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from typing import Any
1010

1111
from shrub.v3.evg_build_variant import BuildVariant
12-
from shrub.v3.evg_command import FunctionCall
12+
from shrub.v3.evg_command import EvgCommandType, FunctionCall, subprocess_exec
1313
from shrub.v3.evg_project import EvgProject
14-
from shrub.v3.evg_task import EvgTask, EvgTaskRef
14+
from shrub.v3.evg_task import EvgTask, EvgTaskDependency, EvgTaskRef
1515
from shrub.v3.shrub_service import ShrubService
1616

1717
##############
@@ -233,6 +233,13 @@ def handle_c_ext(c_ext, expansions) -> None:
233233
expansions["NO_EXT"] = "1"
234234

235235

236+
def get_subprocess_exec(**kwargs):
237+
kwargs.setdefault("binary", "bash")
238+
kwargs.setdefault("working_dir", "src")
239+
kwargs.setdefault("command_type", EvgCommandType.TEST)
240+
return subprocess_exec(**kwargs)
241+
242+
236243
def generate_yaml(tasks=None, variants=None):
237244
"""Generate the yaml for a given set of tasks and variants."""
238245
project = EvgProject(tasks=tasks, buildvariants=variants)
@@ -1055,6 +1062,49 @@ def create_atlas_data_lake_tasks():
10551062
return tasks
10561063

10571064

1065+
def create_getdata_tasks():
1066+
# Wildcard task. Do you need to find out what tools are available and where?
1067+
# Throw it here, and execute this task on all buildvariants
1068+
cmd = get_subprocess_exec(args=[".evergreen/scripts/run-getdata.sh"])
1069+
return [EvgTask(name="getdata", commands=[cmd])]
1070+
1071+
1072+
def create_coverage_report_tasks():
1073+
tags = ["coverage"]
1074+
task_name = "coverage-report"
1075+
# BUILD-3165: We can't use "*" (all tasks) and specify "variant".
1076+
# Instead list out all coverage tasks using tags.
1077+
# Run the coverage task even if some tasks fail.
1078+
# Run the coverage task even if some tasks are not scheduled in a patch build.
1079+
task_deps = []
1080+
for name in [".standalone", ".replica_set", ".sharded_cluster"]:
1081+
task_deps.append(
1082+
EvgTaskDependency(name=name, variant=".coverage_tag", status="*", patch_optional=True)
1083+
)
1084+
cmd = FunctionCall(func="download and merge coverage")
1085+
return [EvgTask(name=task_name, tags=tags, depends_on=task_deps, commands=[cmd])]
1086+
1087+
1088+
def create_import_time_tasks():
1089+
name = "check-import-time"
1090+
tags = ["pr"]
1091+
args = [".evergreen/scripts/check-import-time.sh", "${revision}", "${github_commit}"]
1092+
cmd = get_subprocess_exec(args=args)
1093+
return [EvgTask(name=name, tags=tags, commands=[cmd])]
1094+
1095+
1096+
def create_backport_pr_tasks():
1097+
name = "backport-pr"
1098+
args = [
1099+
"${DRIVERS_TOOLS}/.evergreen/github_app/backport-pr.sh",
1100+
"mongodb",
1101+
"mongo-python-driver",
1102+
"${github_commit}",
1103+
]
1104+
cmd = get_subprocess_exec(args=args)
1105+
return [EvgTask(name=name, commands=[cmd], allowed_requesters=["commit"])]
1106+
1107+
10581108
def create_ocsp_tasks():
10591109
tasks = []
10601110
tests = [

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ repos:
121121
entry: .evergreen/scripts/generate-config.sh
122122
language: python
123123
require_serial: true
124-
additional_dependencies: ["shrub.py>=3.2.0", "pyyaml>=6.0.2"]
124+
additional_dependencies: ["shrub.py>=3.8.0", "pyyaml>=6.0.2"]

0 commit comments

Comments
 (0)