Skip to content

PYTHON-5277 Convert remaining Evergreen functions to generated config #2281

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 5 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
108 changes: 0 additions & 108 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,114 +29,6 @@ include:
- filename: .evergreen/generated_configs/tasks.yml
- filename: .evergreen/generated_configs/variants.yml

functions:
"fetch source":
# Executes clone and applies the submitted patch, if any
- command: git.get_project
params:
directory: "src"
# Applies the subitted patch, if any
# Deprecated. Should be removed. But still needed for certain agents (ZAP)
- command: git.apply_patch

"setup system":
# Make an evergreen expansion file with dynamic values
- command: subprocess.exec
params:
include_expansions_in_env: ["is_patch", "project", "version_id"]
binary: bash
working_dir: "src"
args:
- .evergreen/scripts/setup-system.sh
# Load the expansion file to make an evergreen variable with the current unique version
- command: expansions.update
params:
file: src/expansion.yml

"upload test results":
- command: attach.results
params:
file_location: "${DRIVERS_TOOLS}/results.json"
- command: attach.xunit_results
params:
file: "src/xunit-results/TEST-*.xml"

"run server":
- command: subprocess.exec
params:
binary: bash
working_dir: "src"
include_expansions_in_env: [VERSION, TOPOLOGY, AUTH, SSL, ORCHESTRATION_FILE, PYTHON_BINARY, PYTHON_VERSION, IS_WIN32,
STORAGE_ENGINE, REQUIRE_API_VERSION, DRIVERS_TOOLS, TEST_CRYPT_SHARED, AUTH_AWS, LOAD_BALANCER, LOCAL_ATLAS, NO_EXT]
args: [.evergreen/just.sh, run-server, "${TEST_NAME}"]
- command: expansions.update
params:
file: ${DRIVERS_TOOLS}/mo-expansion.yml

"run just script":
- command: subprocess.exec
type: test
params:
include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]
binary: bash
working_dir: "src"
args: [.evergreen/just.sh, "${JUSTFILE_TARGET}"]

"run tests":
- command: subprocess.exec
type: test
params:
include_expansions_in_env: [AUTH, SSL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
AWS_SESSION_TOKEN, COVERAGE, PYTHON_BINARY, LIBMONGOCRYPT_URL, MONGODB_URI, PYTHON_VERSION, IS_WIN32,
DISABLE_TEST_COMMANDS, GREEN_FRAMEWORK, NO_EXT, COMPRESSORS, MONGODB_API_VERSION, DEBUG_LOG,
ORCHESTRATION_FILE, OCSP_SERVER_TYPE, VERSION, REQUIRE_FIPS]
binary: bash
working_dir: "src"
args: [.evergreen/just.sh, setup-tests, "${TEST_NAME}", "${SUB_TEST_NAME}"]
- command: subprocess.exec
type: test
params:
working_dir: "src"
binary: bash
args: [.evergreen/just.sh, run-tests]

"cleanup":
- command: subprocess.exec
params:
binary: bash
working_dir: "src"
args:
- .evergreen/scripts/cleanup.sh

"teardown system":
- command: subprocess.exec
params:
binary: bash
working_dir: "src"
args: [.evergreen/just.sh, teardown-tests]
- command: subprocess.exec
params:
binary: bash
working_dir: "src"
args:
- ${DRIVERS_TOOLS}/.evergreen/teardown.sh

"assume ec2 role":
- command: ec2.assume_role
params:
role_arn: ${aws_test_secrets_role}
duration_seconds: 3600

"attach benchmark test results":
- command: attach.results
params:
file_location: src/report.json

"send dashboard data":
- command: perf.send
params:
file: src/results.json

pre:
- func: "fetch source"
- func: "setup system"
Expand Down
168 changes: 168 additions & 0 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
functions:
# Assume ec2 role
assume ec2 role:
- command: ec2.assume_role
params:
role_arn: ${aws_test_secrets_role}
duration_seconds: 3600

# Attach benchmark test results
attach benchmark test results:
- command: attach.results
params:
file_location: src/report.json

# Cleanup
cleanup:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/cleanup.sh
working_dir: src
type: test

# Download and merge coverage
download and merge coverage:
- command: ec2.assume_role
Expand Down Expand Up @@ -56,6 +79,142 @@ functions:
optional: "true"
type: setup

# Fetch source
fetch source:
- command: git.get_project
params:
directory: src

# Run just script
run just script:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- ${JUSTFILE_TARGET}
working_dir: src
include_expansions_in_env:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
type: test

# Run server
run server:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- run-server
- ${TEST_NAME}
working_dir: src
include_expansions_in_env:
- VERSION
- TOPOLOGY
- AUTH
- SSL
- ORCHESTRATION_FILE
- PYTHON_BINARY
- PYTHON_VERSION
- STORAGE_ENGINE
- REQUIRE_API_VERSION
- DRIVERS_TOOLS
- TEST_CRYPT_SHARED
- AUTH_AWS
- LOAD_BALANCER
- LOCAL_ATLAS
- NO_EXT
type: test
- command: expansions.update
params:
file: ${DRIVERS_TOOLS}/mo-expansion.yml

# Run tests
run tests:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- setup-tests
- ${TEST_NAME}
- ${SUB_TEST_NAME}
working_dir: src
include_expansions_in_env:
- AUTH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IS_WIN32 is removed from this list, intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it from run server, not run tests, because the server part isn't a factor.

- SSL
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_SESSION_TOKEN
- COVERAGE
- PYTHON_BINARY
- LIBMONGOCRYPT_URL
- MONGODB_URI
- PYTHON_VERSION
- DISABLE_TEST_COMMANDS
- GREEN_FRAMEWORK
- NO_EXT
- COMPRESSORS
- MONGODB_API_VERSION
- DEBUG_LOG
- ORCHESTRATION_FILE
- OCSP_SERVER_TYPE
- VERSION
- IS_WIN32
- REQUIRE_FIPS
type: test
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- run-tests
working_dir: src
type: test

# Send dashboard data
send dashboard data:
- command: perf.send
params:
file: src/results.json

# Setup system
setup system:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/scripts/setup-system.sh
working_dir: src
include_expansions_in_env:
- is_patch
- project
- version_id
type: test
- command: expansions.update
params:
file: src/expansion.yml

# Teardown system
teardown system:
- command: subprocess.exec
params:
binary: bash
args:
- .evergreen/just.sh
- teardown-tests
working_dir: src
type: test
- command: subprocess.exec
params:
binary: bash
args:
- ${DRIVERS_TOOLS}/.evergreen/teardown.sh
working_dir: src
type: test

# Upload coverage
upload coverage:
- command: ec2.assume_role
Expand Down Expand Up @@ -115,3 +274,12 @@ functions:
display_name: drivers-tools-logs.tar.gz
optional: "true"
type: setup

# Upload test results
upload test results:
- command: attach.results
params:
file_location: ${DRIVERS_TOOLS}/results.json
- command: attach.xunit_results
params:
file: src/xunit-results/TEST-*.xml
Loading
Loading