Skip to content

Commit 954cfbe

Browse files
authored
CXX-3126 Refactor EVG config to use config_generator (#1244)
* uv: convert Python requirements into pyproject.toml * generator: import config_generator from C Driver * Remove obsolete reference to install.sh (6a49989) * evg: fix tasks which enable extra alignment * etc: update release instructions with uv commands * evg: backport root-level config options to .mci.yml * evg: improve formatting of CMake arguments list output * Avoid splitting `-D<arg>` in CMake arguments list output * Add a README documenting the Evergreen config generator
1 parent 92a884e commit 954cfbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+9793
-2473
lines changed

.evergreen/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Evergreen Config Generation
2+
3+
## Generation
4+
5+
Use [Astral uv](https://docs.astral.sh/uv/) to run the `config_generator/generate.py` script from the project root directory:
6+
7+
```bash
8+
uv run --frozen .evergreen/config_generator/generate.py
9+
```
10+
11+
Python binary and package requirements are defined in the project root directory's `pyproject.toml` file. When the `pyproject.toml` file is updated, omit `--frozen` to allow `uv.lock` to be updated.
12+
13+
## Layout
14+
15+
The contents of this directory are organized as follows:
16+
17+
- `config.yml`: the root Evergreen config file.
18+
- `generated_configs`: generated Evergreen config files included by `config.yml`.
19+
- `config_generator`: Python scripts used to generate config files under `generated_configs`.
20+
- `scripts`: shell scripts used by the generated Evergreen config.
21+
22+
## Config Generator
23+
24+
Config generator scripts are organized into three subdirectories.
25+
26+
### Components
27+
28+
These scripts define Evergreen functions, tasks, task groups, and build variants. Components which only define Evergreen functions (for reuse by multiple components) are grouped under the `funcs` subdirectory. All other components (which define a task, task group, or build variant) are located outside the `funcs` directory.
29+
30+
### Etc
31+
32+
These scripts define helper utilities used by components, but do not define any Evergreen functions, tasks, task groups, or build variants themselves. These scripts are only imported by scripts under `components`.
33+
34+
### Generators
35+
36+
These scripts are imported by `generate.py` and are each responsible for generating an Evergreen config file under `generated_configs` (`functions.py` generates `functions.yml`, etc.). These scripts only scan the contents of the `components` directory.

.evergreen/build_example_projects.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

.evergreen/config.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Default timeout for all tasks is 1 hour.
2+
# May be overridden by individual tasks.
3+
exec_timeout_secs: 3600
4+
5+
# Default command type is 'system' to indicate failures unrelated to tests or
6+
# their setup. Most commands should define their type as 'setup' or 'test'.
7+
# - setup: before test (lavendar).
8+
# - test: during test (red).
9+
# - system: after test (purple).
10+
command_type: system
11+
12+
# Ensure Evergreen tests earlier commits when a task fails.
13+
stepback: true
14+
15+
# Ensure failure in pre commands is also considered task failure.
16+
pre_error_fails_task: true
17+
18+
# Too many post commands are not designed to handle errors.
19+
# TODO: set to true once failing post commands have been moved into
20+
# teardown_group commands of appropriate task groups.
21+
post_error_fails_task: false
22+
23+
# Commands run after all tasks (excluding those in task groups).
24+
# Use sparingly and ensure they are error-proof.
25+
# TODO: move into teardown_group commands of appropriate task groups.
26+
post:
27+
- func: "stop_mongod"
28+
- func: "backtrace"
29+
# Workaround for CXX-2040
30+
# - func: "upload working dir"
31+
- func: "upload mongo orchestration artifacts"
32+
- func: "upload code coverage"
33+
34+
include:
35+
- filename: .evergreen/generated_configs/functions.yml
36+
- filename: .evergreen/generated_configs/task_groups.yml
37+
- filename: .evergreen/generated_configs/tasks.yml
38+
- filename: .evergreen/generated_configs/variants.yml
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
from config_generator.components.funcs.install_c_driver import InstallCDriver
2+
3+
from config_generator.etc.distros import find_large_distro
4+
from config_generator.etc.function import Function, merge_defns
5+
from config_generator.etc.utils import TaskGroup, bash_exec
6+
7+
from shrub.v3.evg_command import EvgCommandType, git_get_project, s3_put
8+
from shrub.v3.evg_task import EvgTask, EvgTaskRef
9+
from shrub.v3.evg_build_variant import BuildVariant, DisplayTask
10+
11+
12+
TAG = 'abi-stability'
13+
14+
15+
# pylint: disable=line-too-long
16+
# fmt: off
17+
MATRIX = [
18+
('polyfill', 11),
19+
('stdlib', 17),
20+
]
21+
# fmt: on
22+
# pylint: enable=line-too-long
23+
24+
25+
class AbiComplianceCheck(Function):
26+
name = 'abi-compliance-check'
27+
commands = [
28+
bash_exec(
29+
command_type=EvgCommandType.SETUP,
30+
script='mongo-cxx-driver/.evergreen/scripts/abi-compliance-check-setup.sh'
31+
),
32+
bash_exec(
33+
command_type=EvgCommandType.TEST,
34+
script='mongo-cxx-driver/.evergreen/scripts/abi-compliance-check-test.sh'
35+
),
36+
s3_put(
37+
command_type=EvgCommandType.SYSTEM,
38+
aws_key='${aws_key}',
39+
aws_secret='${aws_secret}',
40+
bucket='mciuploads',
41+
content_type='text/html',
42+
display_name='ABI Compliance Check (Stable): ',
43+
local_files_include_filter='cxx-abi/compat_reports/**/compat_report.html',
44+
permissions='public-read',
45+
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/abi/',
46+
),
47+
s3_put(
48+
command_type=EvgCommandType.SYSTEM,
49+
aws_key='${aws_key}',
50+
aws_secret='${aws_secret}',
51+
bucket='mciuploads',
52+
content_type='text/plain',
53+
display_name='ABI Compliance Check (Stable): ',
54+
local_files_include_filter='cxx-abi/logs/**/log.txt',
55+
permissions='public-read',
56+
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/abi/',
57+
),
58+
s3_put(
59+
command_type=EvgCommandType.SYSTEM,
60+
aws_key='${aws_key}',
61+
aws_secret='${aws_secret}',
62+
bucket='mciuploads',
63+
content_type='text/html',
64+
display_name='ABI Compliance Check (Unstable): ',
65+
local_files_include_filter='cxx-noabi/compat_reports/**/compat_report.html',
66+
permissions='public-read',
67+
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/noabi/',
68+
),
69+
s3_put(
70+
command_type=EvgCommandType.SYSTEM,
71+
aws_key='${aws_key}',
72+
aws_secret='${aws_secret}',
73+
bucket='mciuploads',
74+
content_type='text/plain',
75+
display_name='ABI Compliance Check (Unstable): ',
76+
local_files_include_filter='cxx-noabi/logs/**/log.txt',
77+
permissions='public-read',
78+
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/noabi/',
79+
),
80+
]
81+
82+
83+
class Abidiff(Function):
84+
name = 'abidiff'
85+
commands = [
86+
bash_exec(
87+
command_type=EvgCommandType.SETUP,
88+
script='mongo-cxx-driver/.evergreen/scripts/abidiff-setup.sh'
89+
),
90+
bash_exec(
91+
command_type=EvgCommandType.TEST,
92+
script='mongo-cxx-driver/.evergreen/scripts/abidiff-test.sh'
93+
),
94+
s3_put(
95+
command_type=EvgCommandType.SYSTEM,
96+
aws_key='${aws_key}',
97+
aws_secret='${aws_secret}',
98+
bucket='mciuploads',
99+
content_type='text/plain',
100+
display_name='abidiff (Stable): ',
101+
local_files_include_filter='cxx-abi/*.txt',
102+
permissions='public-read',
103+
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abidiff/abi/',
104+
),
105+
s3_put(
106+
command_type=EvgCommandType.SYSTEM,
107+
aws_key='${aws_key}',
108+
aws_secret='${aws_secret}',
109+
bucket='mciuploads',
110+
content_type='text/plain',
111+
display_name='abidiff (Unstable): ',
112+
local_files_include_filter='cxx-noabi/*.txt',
113+
permissions='public-read',
114+
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abidiff/noabi/',
115+
),
116+
]
117+
118+
119+
class AbiProhibitedSymbols(Function):
120+
name = 'abi-prohibited-symbols'
121+
commands = bash_exec(
122+
command_type=EvgCommandType.TEST,
123+
script='mongo-cxx-driver/.evergreen/scripts/abi-prohibited-symbols-test.sh'
124+
)
125+
126+
127+
def functions():
128+
return merge_defns(
129+
AbiComplianceCheck.defn(),
130+
Abidiff.defn(),
131+
AbiProhibitedSymbols.defn(),
132+
)
133+
134+
135+
def tasks():
136+
distro_name = 'ubuntu2204'
137+
distro = find_large_distro(distro_name)
138+
139+
return [
140+
EvgTask(
141+
name=func.name,
142+
tags=[TAG, func.name, distro_name],
143+
run_on=distro.name,
144+
commands=[func.call()],
145+
)
146+
for func in [AbiComplianceCheck, Abidiff, AbiProhibitedSymbols]
147+
]
148+
149+
150+
def task_groups():
151+
return [
152+
TaskGroup(
153+
name=f'tg-{TAG}',
154+
max_hosts=-1,
155+
setup_group_can_fail_task=True,
156+
setup_task=[
157+
git_get_project(directory='mongo-cxx-driver'),
158+
InstallCDriver.call(),
159+
bash_exec(
160+
include_expansions_in_env=['cxx_standard'],
161+
script='mongo-cxx-driver/.evergreen/scripts/abi-stability-setup.sh'
162+
),
163+
],
164+
tasks=[f'.{TAG}'],
165+
teardown_task_can_fail_task=True,
166+
teardown_task=[bash_exec(script='rm -rf *'),],
167+
)
168+
]
169+
170+
171+
def variants():
172+
return [
173+
BuildVariant(
174+
name=f'abi-stability-{name}',
175+
display_name=f'ABI Stability Checks ({name})',
176+
expansions={
177+
'cxx_standard': f'{cxx_standard}', # Use a polyfill library.
178+
},
179+
tasks=[EvgTaskRef(name='tg-abi-stability')],
180+
display_tasks=[
181+
DisplayTask(
182+
name=f'ABI Stability Checks ({name})',
183+
execution_tasks=[f'.{TAG}'],
184+
)
185+
],
186+
)
187+
for name, cxx_standard in MATRIX
188+
]

0 commit comments

Comments
 (0)