Skip to content

CXX-3126 Refactor EVG config to use config_generator #1244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 78 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
c0dd140
uv: convert Python requirements into pyproject.toml
eramongodb Oct 29, 2024
8529646
evg: move EVG files into evergreen-old
eramongodb Oct 29, 2024
dff8771
evg: update references to old EVG files
eramongodb Oct 29, 2024
f301d2d
evg: expand all YAML anchors
eramongodb Oct 29, 2024
2651de8
generator: import config_generator from C Driver
eramongodb Oct 29, 2024
e04fb80
generator: fix pydantic 2.0 compatibility for dumping subclass fields
eramongodb Oct 29, 2024
210740a
generator: add support for C++ Driver EVG config distros
eramongodb Oct 29, 2024
2ade344
generator: add VS compiler -> CMake generator+platform helpers
eramongodb Oct 29, 2024
d8c1150
generator: add support for teardown_task_can_fail_task
eramongodb Oct 29, 2024
a6cffdf
evg: include generated functions.yml in legacy config
eramongodb Oct 29, 2024
c0faac8
functions: abi-compliance-check
eramongodb Oct 29, 2024
cc2c7e6
functions: abidiff
eramongodb Oct 29, 2024
c556b5d
functions: abi-prohibited-symbols
eramongodb Oct 29, 2024
3c90e39
functions: setup
eramongodb Oct 29, 2024
faee0c1
functions: build_mongohouse
eramongodb Oct 29, 2024
6a62698
functions: run_mongohouse
eramongodb Oct 29, 2024
2cc3b4c
functions: test_mongohouse
eramongodb Oct 29, 2024
92ded0f
functions: start_mongod
eramongodb Oct 29, 2024
980000a
functions: stop_mongod
eramongodb Oct 29, 2024
86a48dc
functions: install_c_driver
eramongodb Oct 29, 2024
08e0c4a
functions: fetch_c_driver_source
eramongodb Oct 29, 2024
2518429
functions: lint
eramongodb Oct 29, 2024
3c7952a
functions: clang-tidy
eramongodb Oct 29, 2024
f5404ac
functions: fetch-det (clone_drivers-evergreen-tools)
eramongodb Oct 29, 2024
51787b2
functions: run_kms_servers
eramongodb Oct 29, 2024
ca454f5
functions: compile
eramongodb Oct 29, 2024
db2e904
functions: compile_benchmarks
eramongodb Oct 29, 2024
acfb9fe
functions: test
eramongodb Oct 29, 2024
19920bd
functions: test auth
eramongodb Oct 29, 2024
d1a5945
functions: test atlas connectivity
eramongodb Oct 29, 2024
8470137
functions: backtrace
eramongodb Oct 29, 2024
9d6f039
functions: upload working dir
eramongodb Oct 29, 2024
a8a7956
functions: upload mongo orchestration artifacts
eramongodb Oct 29, 2024
eec5319
functions: upload code coverage
eramongodb Oct 29, 2024
081a918
functions: docker-image-build
eramongodb Oct 29, 2024
082129b
functions: run benchmarks
eramongodb Oct 29, 2024
d486bcb
functions: run scan build
eramongodb Oct 29, 2024
fc316df
functions: upload scan artifacts
eramongodb Oct 29, 2024
840afbe
functions: check augmented sbom
eramongodb Oct 29, 2024
d3b4197
functions: upload augmented sbom
eramongodb Oct 29, 2024
a1cf80c
Remove obsolete reference to install.sh (6a4998952b)
eramongodb Oct 29, 2024
1e827e7
Include all generated configs in legacy config
eramongodb Oct 29, 2024
f72c882
component: abi_stability
eramongodb Oct 29, 2024
64bc2d7
component: atlas_search_indexes
eramongodb Oct 29, 2024
c86cfeb
component: lint
eramongodb Oct 29, 2024
abc0780
component: clang_tidy (ubuntu2004-debug-clang)
eramongodb Oct 29, 2024
e509fec
component: uninstall_check (+ uninstall_check_windows)
eramongodb Oct 29, 2024
c558e75
component: mongohouse
eramongodb Oct 29, 2024
6f417e0
component: silk
eramongodb Oct 29, 2024
2e05c22
component: docker_build
eramongodb Oct 29, 2024
dbfc413
component: packaging
eramongodb Oct 29, 2024
523c39a
component: scan_build
eramongodb Oct 29, 2024
bcf8258
component: compile_only
eramongodb Oct 29, 2024
47e2e55
component: macro_guards
eramongodb Oct 29, 2024
3804db6
component: versioned_api
eramongodb Oct 29, 2024
a47119e
component: compile_only (<- compile_with_shared_libs)
eramongodb Oct 29, 2024
fe02224
component: sanitizers
eramongodb Oct 29, 2024
680f417
component: valgrind
eramongodb Oct 29, 2024
1daefdd
component: benchmarks
eramongodb Oct 29, 2024
c1ae357
component: integration
eramongodb Oct 29, 2024
b5178cb
evg: fix tasks which enable extra alignment
eramongodb Oct 29, 2024
3e718a5
evg: copy post commands from legacy config into new config
eramongodb Oct 29, 2024
752cfa6
evg: improve formatting of CMake flags output
eramongodb Oct 29, 2024
e10c0cd
generator: remove stub component
eramongodb Oct 29, 2024
9cd187a
etc: update release instructions with uv commands
eramongodb Oct 29, 2024
85c01b6
generator: extend extra alignment fixes to valgrind tasks
eramongodb Oct 29, 2024
3bf5f97
generator: do not install libmongocrypt for sanitizer tasks
eramongodb Oct 29, 2024
8f9aca2
evg: backport root-level config options to .mci.yml
eramongodb Oct 30, 2024
e8ca6aa
Use printf to print CMake arguments
eramongodb Nov 7, 2024
080ac18
Avoid splitting `-D<arg>` in CMake arguments list
eramongodb Nov 7, 2024
9fde835
Avoid unintentionally modifying arguments of Python function calls
eramongodb Nov 7, 2024
efb5da3
Provide and use default `call()` in Function
eramongodb Nov 7, 2024
2f3db7d
Use `Path.write_text()` instead of `open()` + `write()`
eramongodb Nov 7, 2024
d8bf224
Fix Bash script indentation
eramongodb Nov 7, 2024
be97570
Remove redundant imports
eramongodb Nov 7, 2024
a5bc5fd
Add a README documenting the Evergreen config generator
eramongodb Nov 7, 2024
6d6deba
README wording tweaks
eramongodb Nov 7, 2024
47b184d
Update README to account for uv lockfile updates
eramongodb Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .evergreen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Evergreen Config Generation

## Generation

Use [Astral uv](https://docs.astral.sh/uv/) to run the `config_generator/generate.py` script from the project root directory:

```bash
uv run --frozen .evergreen/config_generator/generate.py
```

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.

## Layout

The contents of this directory are organized as follows:

- `config.yml`: the root Evergreen config file.
- `generated_configs`: generated Evergreen config files included by `config.yml`.
- `config_generator`: Python scripts used to generate config files under `generated_configs`.
- `scripts`: shell scripts used by the generated Evergreen config.

## Config Generator

Config generator scripts are organized into three subdirectories.

### Components

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.

### Etc

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`.

### Generators

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.
32 changes: 0 additions & 32 deletions .evergreen/build_example_projects.sh

This file was deleted.

38 changes: 38 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Default timeout for all tasks is 1 hour.
# May be overridden by individual tasks.
exec_timeout_secs: 3600

# Default command type is 'system' to indicate failures unrelated to tests or
# their setup. Most commands should define their type as 'setup' or 'test'.
# - setup: before test (lavendar).
# - test: during test (red).
# - system: after test (purple).
command_type: system

# Ensure Evergreen tests earlier commits when a task fails.
stepback: true

# Ensure failure in pre commands is also considered task failure.
pre_error_fails_task: true

# Too many post commands are not designed to handle errors.
# TODO: set to true once failing post commands have been moved into
# teardown_group commands of appropriate task groups.
post_error_fails_task: false

# Commands run after all tasks (excluding those in task groups).
# Use sparingly and ensure they are error-proof.
# TODO: move into teardown_group commands of appropriate task groups.
post:
- func: "stop_mongod"
- func: "backtrace"
# Workaround for CXX-2040
# - func: "upload working dir"
- func: "upload mongo orchestration artifacts"
- func: "upload code coverage"

include:
- filename: .evergreen/generated_configs/functions.yml
- filename: .evergreen/generated_configs/task_groups.yml
- filename: .evergreen/generated_configs/tasks.yml
- filename: .evergreen/generated_configs/variants.yml
188 changes: 188 additions & 0 deletions .evergreen/config_generator/components/abi_stability.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
from config_generator.components.funcs.install_c_driver import InstallCDriver

from config_generator.etc.distros import find_large_distro
from config_generator.etc.function import Function, merge_defns
from config_generator.etc.utils import TaskGroup, bash_exec

from shrub.v3.evg_command import EvgCommandType, git_get_project, s3_put
from shrub.v3.evg_task import EvgTask, EvgTaskRef
from shrub.v3.evg_build_variant import BuildVariant, DisplayTask


TAG = 'abi-stability'


# pylint: disable=line-too-long
# fmt: off
MATRIX = [
('polyfill', 11),
('stdlib', 17),
]
# fmt: on
# pylint: enable=line-too-long


class AbiComplianceCheck(Function):
name = 'abi-compliance-check'
commands = [
bash_exec(
command_type=EvgCommandType.SETUP,
script='mongo-cxx-driver/.evergreen/scripts/abi-compliance-check-setup.sh'
),
bash_exec(
command_type=EvgCommandType.TEST,
script='mongo-cxx-driver/.evergreen/scripts/abi-compliance-check-test.sh'
),
s3_put(
command_type=EvgCommandType.SYSTEM,
aws_key='${aws_key}',
aws_secret='${aws_secret}',
bucket='mciuploads',
content_type='text/html',
display_name='ABI Compliance Check (Stable): ',
local_files_include_filter='cxx-abi/compat_reports/**/compat_report.html',
permissions='public-read',
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/abi/',
),
s3_put(
command_type=EvgCommandType.SYSTEM,
aws_key='${aws_key}',
aws_secret='${aws_secret}',
bucket='mciuploads',
content_type='text/plain',
display_name='ABI Compliance Check (Stable): ',
local_files_include_filter='cxx-abi/logs/**/log.txt',
permissions='public-read',
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/abi/',
),
s3_put(
command_type=EvgCommandType.SYSTEM,
aws_key='${aws_key}',
aws_secret='${aws_secret}',
bucket='mciuploads',
content_type='text/html',
display_name='ABI Compliance Check (Unstable): ',
local_files_include_filter='cxx-noabi/compat_reports/**/compat_report.html',
permissions='public-read',
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/noabi/',
),
s3_put(
command_type=EvgCommandType.SYSTEM,
aws_key='${aws_key}',
aws_secret='${aws_secret}',
bucket='mciuploads',
content_type='text/plain',
display_name='ABI Compliance Check (Unstable): ',
local_files_include_filter='cxx-noabi/logs/**/log.txt',
permissions='public-read',
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abi-compliance-check/noabi/',
),
]


class Abidiff(Function):
name = 'abidiff'
commands = [
bash_exec(
command_type=EvgCommandType.SETUP,
script='mongo-cxx-driver/.evergreen/scripts/abidiff-setup.sh'
),
bash_exec(
command_type=EvgCommandType.TEST,
script='mongo-cxx-driver/.evergreen/scripts/abidiff-test.sh'
),
s3_put(
command_type=EvgCommandType.SYSTEM,
aws_key='${aws_key}',
aws_secret='${aws_secret}',
bucket='mciuploads',
content_type='text/plain',
display_name='abidiff (Stable): ',
local_files_include_filter='cxx-abi/*.txt',
permissions='public-read',
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abidiff/abi/',
),
s3_put(
command_type=EvgCommandType.SYSTEM,
aws_key='${aws_key}',
aws_secret='${aws_secret}',
bucket='mciuploads',
content_type='text/plain',
display_name='abidiff (Unstable): ',
local_files_include_filter='cxx-noabi/*.txt',
permissions='public-read',
remote_file='mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/abidiff/noabi/',
),
]


class AbiProhibitedSymbols(Function):
name = 'abi-prohibited-symbols'
commands = bash_exec(
command_type=EvgCommandType.TEST,
script='mongo-cxx-driver/.evergreen/scripts/abi-prohibited-symbols-test.sh'
)


def functions():
return merge_defns(
AbiComplianceCheck.defn(),
Abidiff.defn(),
AbiProhibitedSymbols.defn(),
)


def tasks():
distro_name = 'ubuntu2204'
distro = find_large_distro(distro_name)

return [
EvgTask(
name=func.name,
tags=[TAG, func.name, distro_name],
run_on=distro.name,
commands=[func.call()],
)
for func in [AbiComplianceCheck, Abidiff, AbiProhibitedSymbols]
]


def task_groups():
return [
TaskGroup(
name=f'tg-{TAG}',
max_hosts=-1,
setup_group_can_fail_task=True,
setup_task=[
git_get_project(directory='mongo-cxx-driver'),
InstallCDriver.call(),
bash_exec(
include_expansions_in_env=['cxx_standard'],
script='mongo-cxx-driver/.evergreen/scripts/abi-stability-setup.sh'
),
],
tasks=[f'.{TAG}'],
teardown_task_can_fail_task=True,
teardown_task=[bash_exec(script='rm -rf *'),],
)
]


def variants():
return [
BuildVariant(
name=f'abi-stability-{name}',
display_name=f'ABI Stability Checks ({name})',
expansions={
'cxx_standard': f'{cxx_standard}', # Use a polyfill library.
},
tasks=[EvgTaskRef(name='tg-abi-stability')],
display_tasks=[
DisplayTask(
name=f'ABI Stability Checks ({name})',
execution_tasks=[f'.{TAG}'],
)
],
)
for name, cxx_standard in MATRIX
]
Loading