Skip to content

Commit 85d89f5

Browse files
Fix and update EVG configuration for r1.30 (#2076)
* CDRIVER-5891 address implicit bool-to-null conversion in return statements (#1888) * CDRIVER-5891 extend C standard coverage up to C23 (#1890) * CDRIVER-5959 sync change streams unified spec tests with 0aee4aad (#1971) * CDRIVER-5304 set cluster time in test sessions (#2008) * Ignore -Wpre-c11-compat warnings when building public-header-warnings (#2027) * CDRIVER-6042 Migrate Python scripts from Poetry to Astral UV (#2039) * Migrate EVG task coverage to latest Debian, Ubuntu, and RHEL distros (#2044) * CDRIVER-6010 use `ec2.assume_role` for Azure KMS task (#2051) * CDRIVER-5971 Use Amazon ECR to obtain OCI images in EVG (#2058) * update Earthly version from 0.8.3 to 0.8.16 (#2072) --------- Co-authored-by: Kevin Albertson <[email protected]>
1 parent 07ba58b commit 85d89f5

File tree

75 files changed

+4318
-3134
lines changed

Some content is hidden

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

75 files changed

+4318
-3134
lines changed

.evergreen/config_generator/README.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,22 @@
33
The scripts in this directory are used to generate the Evergreen configuration
44
files stored in `.evergreen/generated_configs/`.
55

6-
The easiest way to execute these scripts is using the Poetry to install the
7-
dependencies and then run the scripts.
6+
The easiest way to execute these scripts is to use [uv](https://docs.astral.sh/uv/) to run the scripts.
87

98
**Note**: These scripts require Python 3.10 or newer.
109

1110

1211
## Setting Up
1312

14-
Before running, use Poetry to install a virtualenv containing the dependencies.
15-
This can be done by using the `poetry.sh` (or `poetry.ps1`) script contained in
16-
the `tools/` directory at the root of the `mongo-c-driver` repository:
17-
18-
```sh
19-
./tools/poetry.sh install --with=dev
20-
```
21-
22-
Or with PowerShell:
23-
24-
```pwsh
25-
./tools/poetry.ps1 install --with=dev
26-
```
13+
`uv` is required to run Python scripts. See ["Installing uv"](https://docs.astral.sh/uv/getting-started/installation/) for instructions on how to obtain `uv`.
2714

2815

2916
## Running the Generator
3017

31-
The package defines a program `mc-evg-generate`, which can be run within the
32-
virtualenv. This can be done via Poetry as well, following the setup:
18+
The package provides the `mc-evg-generate` [entry point](https://packaging.python.org/en/latest/specifications/entry-points):
3319

3420
```sh
35-
./tools/poetry.sh run mc-evg-generate
21+
uv run --frozen mc-evg-generate
3622
```
3723

3824
This command will ready the generation files and generate a new set of Evergreen

.evergreen/config_generator/components/c_std_compile.py

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from config_generator.etc.distros import find_large_distro
88
from config_generator.etc.distros import make_distro_str
9-
from config_generator.etc.distros import to_cc
9+
from config_generator.etc.distros import compiler_to_vars
1010
from config_generator.etc.function import Function
1111
from config_generator.etc.utils import bash_exec
1212

@@ -17,14 +17,31 @@
1717
# pylint: disable=line-too-long
1818
# fmt: off
1919
MATRIX = [
20-
('debian92', 'clang', None, [11, ]),
21-
('debian10', 'clang', None, [11, ]),
22-
('debian10', 'gcc', None, [11, 17]),
23-
('debian11', 'clang', None, [11, ]),
24-
('debian11', 'gcc', None, [11, 17]),
25-
('ubuntu2004', 'clang', None, [11, ]),
26-
('ubuntu2004', 'gcc', None, [11, ]),
27-
('windows-vsCurrent', 'vs2017x64', None, [11, 17]),
20+
('rhel80', 'clang', None, [99, 11, 17, ]), # Clang 7.0
21+
('ubuntu2004', 'clang-10', None, [99, 11, 17, 23]), # Clang 10.0 (max: C2x)
22+
('rhel84', 'clang', None, [99, 11, 17, 23]), # Clang 11.0 (max: C2x)
23+
('ubuntu2204', 'clang-12', None, [99, 11, 17, 23]), # Clang 12.0 (max: C2x)
24+
('rhel90', 'clang', None, [99, 11, 17, 23]), # Clang 13.0 (max: C2x)
25+
('rhel91', 'clang', None, [99, 11, 17, 23]), # Clang 14.0 (max: C2x)
26+
('rhel92', 'clang', None, [99, 11, 17, 23]), # Clang 15.0 (max: C2x)
27+
('rhel93', 'clang', None, [99, 11, 17, 23]), # Clang 16.0 (max: C2x)
28+
('rhel94', 'clang', None, [99, 11, 17, 23]), # Clang 17.0 (max: C2x)
29+
('rhel95', 'clang', None, [99, 11, 17, 23]), # Clang 18.0 (max: C23)
30+
31+
('rhel7-latest', 'gcc', None, [99, 11, ]), # GCC 4.8 (max: C11)
32+
('rhel80', 'gcc', None, [99, 11, 17, ]), # GCC 8.2 (max: C17)
33+
('rhel84', 'gcc', None, [99, 11, 17, ]), # GCC 8.4 (max: C17)
34+
('ubuntu2004', 'gcc-9', None, [99, 11, 17, 23]), # GCC 9.4 (max: C2x)
35+
('debian11', 'gcc-10', None, [99, 11, 17, 23]), # GCC 10.2 (max: C2x)
36+
('rhel90', 'gcc', None, [99, 11, 17, 23]), # GCC 11.2 (max: C2x)
37+
('rhel92', 'gcc', None, [99, 11, 17, 23]), # GCC 11.3 (max: C2x)
38+
('rhel94', 'gcc', None, [99, 11, 17, 23]), # GCC 11.4 (max: C2x)
39+
('rhel95', 'gcc', None, [99, 11, 17, 23]), # GCC 11.5 (max: C2x)
40+
('ubuntu2404', 'gcc-13', None, [99, 11, 17, 23]), # GCC 13.3 (max: C2x)
41+
42+
('windows-vsCurrent', 'vs2017x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
43+
('windows-vsCurrent', 'vs2019x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
44+
('windows-vsCurrent', 'vs2022x64', None, [99, 11, 17, 'latest']), # Max: C17, clatest (C2x)
2845
]
2946
# fmt: on
3047
# pylint: enable=line-too-long
@@ -54,18 +71,20 @@ def tasks():
5471
res = []
5572

5673
for distro_name, compiler, arch, stds in MATRIX:
57-
tags = [TAG, distro_name, compiler, 'compile']
74+
compiler_type = compiler.split('-')[0]
75+
76+
tags = [TAG, distro_name, compiler_type, 'compile']
5877

5978
distro = find_large_distro(distro_name)
6079

6180
compile_vars = None
62-
compile_vars = {'CC': to_cc(compiler)}
81+
compile_vars = compiler_to_vars(compiler)
6382

6483
if arch:
6584
tags.append(arch)
6685
compile_vars.update({'MARCH': arch})
6786

68-
distro_str = make_distro_str(distro_name, compiler, arch)
87+
distro_str = make_distro_str(distro_name, compiler_type, arch)
6988

7089
for std in stds:
7190
with_std = {'C_STD_VERSION': std}

.evergreen/config_generator/components/clang_format.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,24 @@
33
from shrub.v3.evg_task import EvgTask
44
from shrub.v3.evg_task import EvgTaskRef
55

6-
from config_generator.etc.distros import find_large_distro
6+
from config_generator.etc.distros import find_small_distro
77
from config_generator.etc.function import Function
88
from config_generator.etc.utils import bash_exec
99

1010

1111
TAG = "clang-format"
1212

13-
DISTROS = [
14-
find_large_distro("ubuntu2204").name,
15-
find_large_distro("ubuntu2004").name,
16-
]
17-
1813

1914
class ClangFormat(Function):
2015
name = TAG
2116
commands = [
22-
bash_exec(
23-
command_type=EvgCommandType.SETUP,
24-
working_dir="mongoc",
25-
script="./tools/poetry.sh install --with=dev"
26-
),
2717
bash_exec(
2818
command_type=EvgCommandType.TEST,
2919
working_dir="mongoc",
3020
env={
3121
"DRYRUN": "1",
3222
},
33-
script="./tools/poetry.sh run .evergreen/scripts/clang-format-all.sh",
23+
script="uv run --frozen --only-group format .evergreen/scripts/clang-format-all.sh",
3424
),
3525
]
3626

@@ -56,7 +46,7 @@ def variants():
5646
BuildVariant(
5747
name=TAG,
5848
display_name=TAG,
59-
run_on=DISTROS,
49+
run_on=[find_small_distro("ubuntu2204").name],
6050
tasks=[EvgTaskRef(name=f'.{TAG}')],
6151
),
6252
]

.evergreen/config_generator/components/cse/openssl.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,40 @@
1515
# pylint: disable=line-too-long
1616
# fmt: off
1717
COMPILE_MATRIX = [
18-
('debian92', 'clang', None, ['cyrus']),
19-
('debian92', 'gcc', None, ['cyrus']),
20-
('debian10', 'clang', None, ['cyrus']),
21-
('debian10', 'gcc', None, ['cyrus']),
22-
('debian11', 'clang', None, ['cyrus']),
23-
('debian11', 'gcc', None, ['cyrus']),
24-
('rhel80', 'gcc', None, ['cyrus']),
18+
# For test matrix.
19+
('rhel8-latest', 'gcc', None, ['cyrus']),
2520
('rhel8-zseries', 'gcc', None, ['cyrus']),
26-
('ubuntu2004', 'clang', None, ['cyrus']),
27-
('ubuntu2004', 'gcc', None, ['cyrus']),
2821
('ubuntu2004-arm64', 'gcc', None, ['cyrus']),
2922
('windows-vsCurrent', 'vs2017x64', None, ['cyrus']),
23+
24+
# For compile only.
25+
('debian11', 'clang', None, ['cyrus']),
26+
('debian11', 'gcc', None, ['cyrus']),
27+
('debian12', 'clang', None, ['cyrus']),
28+
('debian12', 'gcc', None, ['cyrus']),
29+
('rhel80', 'gcc', None, ['cyrus']),
30+
('ubuntu2004', 'gcc', None, ['cyrus']),
31+
('ubuntu2004', 'clang', None, ['cyrus']),
32+
('ubuntu2204', 'gcc', None, ['cyrus']),
33+
('ubuntu2204', 'clang-12', None, ['cyrus']),
34+
('ubuntu2404', 'gcc', None, ['cyrus']),
35+
('ubuntu2404', 'clang-14', None, ['cyrus']),
3036
]
3137

3238
# TODO (CDRIVER-3789): test cse with the 'sharded' topology.
39+
# CSFLE requires 4.2+. QE requires 7.0+ and are skipped on "server" tasks.
3340
TEST_MATRIX = [
34-
# 4.2 and 4.4 not available on rhel8-zseries.
35-
('rhel8-zseries', 'gcc', None, 'cyrus', ['auth'], ['server'], ['5.0']),
41+
# rhel8-latest provides 4.2+.
42+
('rhel8-latest', 'gcc', None, 'cyrus', ['auth'], ['server', 'replica'], ['4.2', '4.4', '5.0', '6.0', '7.0', '8.0', 'latest']),
3643

37-
('windows-vsCurrent', 'vs2017x64', None, 'cyrus', ['auth'], ['server'], ['4.2', '4.4', '5.0', '6.0' ]),
44+
# windows-vsCurrent provides 4.2+.
45+
('windows-vsCurrent', 'vs2017x64', None, 'cyrus', ['auth'], ['server', 'replica'], ['4.2', '4.4', '5.0', '6.0', '7.0', '8.0', 'latest']),
3846

39-
# Test 7.0+ with a replica set since Queryable Encryption does not support the 'server' topology. Queryable Encryption tests require 7.0+.
40-
('ubuntu2004', 'gcc', None, 'cyrus', ['auth'], ['server', 'replica'], ['4.4', '5.0', '6.0', '7.0', '8.0', 'latest']),
41-
('rhel8-zseries', 'gcc', None, 'cyrus', ['auth'], ['server', 'replica'], [ '7.0', '8.0', 'latest']),
42-
('ubuntu2004-arm64', 'gcc', None, 'cyrus', ['auth'], ['server', 'replica'], ['4.4', '5.0', '6.0', '7.0', '8.0', 'latest']),
43-
('windows-vsCurrent', 'vs2017x64', None, 'cyrus', ['auth'], ['server', 'replica'], [ '7.0', '8.0', 'latest']),
47+
# ubuntu2004-arm64 provides 4.4+.
48+
('ubuntu2004-arm64', 'gcc', None, 'cyrus', ['auth'], ['server', 'replica'], ['4.4', '5.0', '6.0', '7.0', '8.0', 'latest']),
4449

45-
# Test 4.2 with Debian 10 since 4.2 does not ship on Ubuntu 20.04+.
46-
('debian10', 'gcc', None, 'cyrus', ['auth'], ['server', 'replica'], ['4.2']),
50+
# rhel8-zseries provides 5.0+.
51+
('rhel8-zseries', 'gcc', None, 'cyrus', ['auth'], ['server', 'replica'], ['5.0', '6.0', '7.0', '8.0', 'latest']),
4752
]
4853
# fmt: on
4954
# pylint: enable=line-too-long
@@ -106,6 +111,8 @@ def variants():
106111
else:
107112
tasks.append(task.get_task_ref())
108113

114+
tasks.sort(key=lambda t: t.name)
115+
109116
return [
110117
BuildVariant(
111118
name=TAG,

.evergreen/config_generator/components/earthly.py

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@
55
from typing import Iterable, Literal, Mapping, NamedTuple, TypeVar
66

77
from shrub.v3.evg_build_variant import BuildVariant
8-
from shrub.v3.evg_command import BuiltInCommand, EvgCommandType, subprocess_exec
8+
from shrub.v3.evg_command import (
9+
BuiltInCommand,
10+
EvgCommandType,
11+
KeyValueParam,
12+
ec2_assume_role,
13+
expansions_update,
14+
subprocess_exec,
15+
)
916
from shrub.v3.evg_task import EvgTask, EvgTaskRef
1017

18+
from config_generator.etc.function import Function
19+
1120
from ..etc.utils import all_possible
1221

1322
T = TypeVar("T")
@@ -138,6 +147,34 @@ def suffix(self) -> str:
138147
return f"{_SEPARATOR}".join(f"{k}={v}" for k, v in self._asdict().items())
139148

140149

150+
# Authenticate with DevProd-provided Amazon ECR instance to use as pull-through cache for DockerHub.
151+
class DockerLoginAmazonECR(Function):
152+
name = 'docker-login-amazon-ecr'
153+
commands = [
154+
# Avoid inadvertently using a pre-existing and potentially conflicting Docker config.
155+
expansions_update(updates=[KeyValueParam(key='DOCKER_CONFIG', value='${workdir}/.docker')]),
156+
ec2_assume_role(role_arn="arn:aws:iam::901841024863:role/ecr-role-evergreen-ro"),
157+
subprocess_exec(
158+
binary="bash",
159+
command_type=EvgCommandType.SETUP,
160+
include_expansions_in_env=[
161+
"AWS_ACCESS_KEY_ID",
162+
"AWS_SECRET_ACCESS_KEY",
163+
"AWS_SESSION_TOKEN",
164+
"DOCKER_CONFIG",
165+
],
166+
args=[
167+
"-c",
168+
'aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 901841024863.dkr.ecr.us-east-1.amazonaws.com',
169+
],
170+
),
171+
]
172+
173+
@classmethod
174+
def call(cls, **kwargs):
175+
return cls.default_call(**kwargs)
176+
177+
141178
def task_filter(env: EarthlyVariant, conf: Configuration) -> bool:
142179
"""
143180
Control which tasks are actually defined by matching on the platform and
@@ -189,11 +226,16 @@ def earthly_exec(
189226
return subprocess_exec(
190227
"./tools/earthly.sh",
191228
args=[
229+
# Use Amazon ECR as pull-through cache for DockerHub to avoid rate limits.
230+
"--buildkit-image=901841024863.dkr.ecr.us-east-1.amazonaws.com/dockerhub/earthly/buildkitd:v0.8.3",
192231
*(f"--secret={k}" for k in (secrets or ())),
193232
f"+{target}",
233+
# Use Amazon ECR as pull-through cache for DockerHub to avoid rate limits.
234+
"--default_search_registry=901841024863.dkr.ecr.us-east-1.amazonaws.com/dockerhub",
194235
*(f"--{arg}={val}" for arg, val in (args or {}).items()),
195236
],
196237
command_type=EvgCommandType(kind),
238+
include_expansions_in_env=["DOCKER_CONFIG"],
197239
env=env if env else None,
198240
working_dir="mongoc",
199241
)
@@ -228,15 +270,7 @@ def earthly_task(
228270
return EvgTask(
229271
name=name,
230272
commands=[
231-
# Ensure subsequent Docker commands are authenticated.
232-
subprocess_exec(
233-
binary='bash',
234-
command_type="setup",
235-
args=[
236-
"-c",
237-
'docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"'
238-
],
239-
),
273+
DockerLoginAmazonECR.call(),
240274
# First, just build the "env-warmup" which will prepare the build environment.
241275
# This won't generate any output, but allows EVG to track it as a separate build step
242276
# for timing and logging purposes. The subequent build step will cache-hit the
@@ -260,13 +294,18 @@ def earthly_task(
260294

261295

262296
CONTAINER_RUN_DISTROS = [
263-
"ubuntu2204-large",
264-
"debian10-large",
265-
"debian11-large",
266297
"amazon2",
298+
"debian11-large",
299+
"debian12-large",
300+
"ubuntu2204-large",
301+
"ubuntu2404-large",
267302
]
268303

269304

305+
def functions():
306+
return DockerLoginAmazonECR.defn()
307+
308+
270309
def tasks() -> Iterable[EvgTask]:
271310
for conf in all_possible(Configuration):
272311
# test-example is a target in all configurations

.evergreen/config_generator/components/loadbalanced.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from config_generator.etc.distros import make_distro_str, find_small_distro, find_large_distro
1313
from config_generator.etc.utils import bash_exec
1414

15-
# Use `rhel8.9` distro. `rhel8.9` distro includes necessary dependency: `haproxy`.
16-
_DISTRO_NAME = "rhel8.9"
15+
# Use `rhel8-latest` distro. `rhel8-latest` distro includes necessary dependency: `haproxy`.
16+
_DISTRO_NAME = "rhel8-latest"
1717
_COMPILER = "gcc"
1818

1919

.evergreen/config_generator/components/make_docs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ class MakeDocs(Function):
1717
working_dir="mongoc",
1818
include_expansions_in_env=["distro_id"],
1919
script="""\
20-
set -o errexit
21-
./tools/poetry.sh install --with=docs
2220
# See SphinxBuild.cmake for EVG_DOCS_BUILD reasoning
23-
./tools/poetry.sh run env EVG_DOCS_BUILD=1 .evergreen/scripts/build-docs.sh
24-
""",
21+
uv run --frozen --only-group docs env EVG_DOCS_BUILD=1 .evergreen/scripts/build-docs.sh
22+
""",
2523
),
2624
]
2725

0 commit comments

Comments
 (0)