Skip to content

Commit 1f756d6

Browse files
authored
CDRIVER-6071 replace build-and-test-with-toolchain with openssl-compat (#2082)
* Remove build-and-test-with-toolchain task * Add openssl-downloader.sh * CDRIVER-5995: unskip relevant auth tests * Fix and update run-auth-tests.sh * Fix and update run-aws-tests.sh * Fix and update run-ocsp-test.sh * Migrate OpenSSL compatibility checks into openssl-compat matrix * Disable failing OCSP darwinssl tasks * Add verification of shared vs. static linkage of OpenSSL * Remove obsolete BYPASS_FIND_CMAKE branches * Support forwarding extra CMake flags to compile_libmongocrypt * Add reference to CDRIVER-3759
1 parent 3385ba9 commit 1f756d6

18 files changed

+2403
-8036
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
from config_generator.etc.distros import find_large_distro, make_distro_str
2+
from config_generator.etc.function import Function
3+
from config_generator.etc.utils import bash_exec
4+
5+
from config_generator.components.funcs.fetch_source import FetchSource
6+
from config_generator.components.funcs.find_cmake_latest import FindCMakeLatest
7+
8+
from shrub.v3.evg_build_variant import BuildVariant
9+
from shrub.v3.evg_command import EvgCommandType, FunctionCall
10+
from shrub.v3.evg_task import EvgTask, EvgTaskRef
11+
12+
from itertools import product
13+
14+
TAG = 'openssl-compat'
15+
16+
# pylint: disable=line-too-long
17+
# fmt: off
18+
OPENSSL_MATRIX = [
19+
('ubuntu2404', 'gcc', ['shared', 'static'], ['1.0.2', '1.1.1', '3.0.9', '3.1.2', '3.2.5', '3.3.4', '3.4.2', '3.5.1']),
20+
]
21+
# fmt: on
22+
23+
# pylint: disable=line-too-long
24+
# fmt: off
25+
OPENSSL_FIPS_MATRIX = [
26+
# https://openssl-library.org/source/
27+
# > The following OpenSSL version(s) are FIPS validated:
28+
# > - 3.1.2: FIPS 140-3
29+
# > - 3.0.9: FIPS 140-2
30+
# > - ...
31+
('ubuntu2404', 'gcc', ['shared', 'static'], ['3.0.9', '3.1.2']),
32+
]
33+
# fmt: on
34+
35+
36+
class OpenSSLSetup(Function):
37+
name = 'openssl-compat'
38+
commands = [
39+
bash_exec(
40+
command_type=EvgCommandType.SETUP,
41+
working_dir='mongoc',
42+
include_expansions_in_env=['OPENSSL_VERSION', 'OPENSSL_ENABLE_FIPS', 'OPENSSL_USE_STATIC_LIBS'],
43+
script='.evergreen/scripts/openssl-compat-setup.sh',
44+
),
45+
bash_exec(
46+
command_type=EvgCommandType.SETUP,
47+
working_dir='mongoc',
48+
include_expansions_in_env=['OPENSSL_VERSION', 'OPENSSL_USE_STATIC_LIBS'],
49+
script='.evergreen/scripts/openssl-compat-check.sh',
50+
),
51+
]
52+
53+
54+
def functions():
55+
return OpenSSLSetup.defn()
56+
57+
58+
def tasks():
59+
for distro_name, compiler, link_types, versions in OPENSSL_MATRIX:
60+
distro_str = make_distro_str(distro_name, compiler, None)
61+
62+
for link_type, version in product(link_types, versions):
63+
vars = {'OPENSSL_VERSION': version}
64+
65+
if link_type == 'static':
66+
vars |= {'OPENSSL_USE_STATIC_LIBS': 'ON'}
67+
68+
yield EvgTask(
69+
name=f'{TAG}-{version}-{link_type}-{distro_str}',
70+
run_on=find_large_distro(distro_name).name,
71+
tags=[TAG, f'openssl-{version}', f'openssl-{link_type}', distro_name, compiler],
72+
commands=[
73+
FetchSource.call(),
74+
FindCMakeLatest.call(),
75+
OpenSSLSetup.call(vars=vars),
76+
FunctionCall(func="run auth tests"),
77+
],
78+
)
79+
80+
for distro_name, compiler, link_types, versions in OPENSSL_FIPS_MATRIX:
81+
distro_str = make_distro_str(distro_name, compiler, None)
82+
83+
for link_type, version in product(link_types, versions):
84+
vars = {'OPENSSL_VERSION': version, 'OPENSSL_ENABLE_FIPS': 'ON'}
85+
86+
if link_type == 'static':
87+
vars |= {'OPENSSL_USE_STATIC_LIBS': 'ON'}
88+
89+
yield EvgTask(
90+
name=f'{TAG}-fips-{version}-{link_type}-{distro_str}',
91+
run_on=find_large_distro(distro_name).name,
92+
tags=[TAG, f'openssl-fips-{version}', f'openssl-{link_type}', distro_name, compiler],
93+
commands=[
94+
FetchSource.call(),
95+
FindCMakeLatest.call(),
96+
OpenSSLSetup.call(vars=vars),
97+
FunctionCall(func="run auth tests"),
98+
],
99+
)
100+
101+
102+
def variants():
103+
return [
104+
BuildVariant(
105+
name=f'{TAG}-matrix',
106+
display_name='OpenSSL Compatibility Matrix',
107+
tasks=[EvgTaskRef(name=f'.{TAG}')],
108+
),
109+
]

.evergreen/config_generator/components/openssl_static_compile.py

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

.evergreen/generated_configs/functions.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,30 @@ functions:
327327
- |
328328
# See SphinxBuild.cmake for EVG_DOCS_BUILD reasoning
329329
uv run --frozen --only-group docs env EVG_DOCS_BUILD=1 .evergreen/scripts/build-docs.sh
330-
openssl-static-compile:
330+
openssl-compat:
331331
- command: subprocess.exec
332-
type: test
332+
type: setup
333333
params:
334334
binary: bash
335335
working_dir: mongoc
336-
add_expansions_to_env: true
336+
include_expansions_in_env:
337+
- OPENSSL_VERSION
338+
- OPENSSL_ENABLE_FIPS
339+
- OPENSSL_USE_STATIC_LIBS
340+
args:
341+
- -c
342+
- .evergreen/scripts/openssl-compat-setup.sh
343+
- command: subprocess.exec
344+
type: setup
345+
params:
346+
binary: bash
347+
working_dir: mongoc
348+
include_expansions_in_env:
349+
- OPENSSL_VERSION
350+
- OPENSSL_USE_STATIC_LIBS
337351
args:
338352
- -c
339-
- .evergreen/scripts/compile-openssl-static.sh
353+
- .evergreen/scripts/openssl-compat-check.sh
340354
restore-instance-profile:
341355
- command: subprocess.exec
342356
params:

0 commit comments

Comments
 (0)