From 81a532a8cd113a699d8b322cf2d28bc49198fcb8 Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Fri, 17 Oct 2025 12:16:28 -0700 Subject: [PATCH 1/2] CSHARP-5771: Install only required SDK/runtimes on EG test variants --- build.cake | 68 +----- build.config | 1 - build.ps1 | 83 +------ build.sh | 43 +--- evergreen/compile.sh | 22 -- evergreen/evergreen.yml | 293 ++++++++++++++++-------- evergreen/install-dotnet.sh | 27 ++- evergreen/run-csfle-azure-tests.sh | 5 +- evergreen/run-csfle-gcp-tests.sh | 5 +- evergreen/run-gssapi-auth-tests.sh | 6 +- evergreen/run-load-balancer-tests.sh | 8 +- evergreen/run-mongodb-aws-ecs-test.sh | 5 +- evergreen/run-mongodb-oidc-env-tests.sh | 9 +- evergreen/run-tests.sh | 4 - 14 files changed, 248 insertions(+), 331 deletions(-) delete mode 100755 evergreen/compile.sh diff --git a/build.cake b/build.cake index fc2432a722f..031fed96be8 100644 --- a/build.cake +++ b/build.cake @@ -31,11 +31,6 @@ var mongoDbDriverPackageName = "MongoDB.Driver"; var solutionFile = solutionDirectory.CombineWithFilePath("CSharpDriver.sln"); var solutionFullPath = solutionFile.FullPath; -var srcProjectNames = new[] -{ - "MongoDB.Bson", - "MongoDB.Driver" -}; Task("Default") .IsDependentOn("Test"); @@ -70,13 +65,6 @@ Task("Build") } }; - if (buildConfig.IsReleaseMode) - { - Console.WriteLine("Build continuousIntegration is enabled"); - settings.MSBuildSettings = new DotNetMSBuildSettings(); - // configure deterministic build for better compatibility with debug symbols (used in Package/Build tasks). Affects: *.nupkg - settings.MSBuildSettings.SetContinuousIntegrationBuild(continuousIntegrationBuild: true); - } DotNetBuild(solutionFullPath, settings); }); @@ -132,10 +120,6 @@ Task("Test") }) .DeferOnError(); -Task("TestNet472").IsDependentOn("Test"); -Task("TestNetStandard21").IsDependentOn("Test"); -Task("TestNet60").IsDependentOn("Test"); - Task("TestAwsAuthentication") .IsDependentOn("Build") .DoesForEach( @@ -184,10 +168,6 @@ Task("TestGssapi") action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject, filter: "Category=\"GssapiMechanism\"")); -Task("TestGssapiNet472").IsDependentOn("TestGssapi"); -Task("TestGssapiNetStandard21").IsDependentOn("TestGssapi"); -Task("TestGssapiNet60").IsDependentOn("TestGssapi"); - Task("TestMongoDbOidc") .IsDependentOn("Build") .DoesForEach( @@ -208,13 +188,6 @@ Task("TestLoadBalanced") action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject, filter: "Category=\"SupportLoadBalancing\"")); -Task("TestLoadBalancedNetStandard21").IsDependentOn("TestLoadBalanced"); -Task("TestLoadBalancedNet60").IsDependentOn("TestLoadBalanced"); - -Task("TestSocks5ProxyNet472").IsDependentOn("TestSocks5Proxy"); -Task("TestSocks5ProxyNetStandard21").IsDependentOn("TestSocks5Proxy"); -Task("TestSocks5ProxyNet60").IsDependentOn("TestSocks5Proxy"); - Task("TestCsfleWithMockedKms") .IsDependentOn("TestLibMongoCrypt") .DoesForEach( @@ -222,10 +195,6 @@ Task("TestCsfleWithMockedKms") action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject, filter: "Category=\"CSFLE\"")); -Task("TestCsfleWithMockedKmsNet472").IsDependentOn("TestCsfleWithMockedKms"); -Task("TestCsfleWithMockedKmsNetStandard21").IsDependentOn("TestCsfleWithMockedKms"); -Task("TestCsfleWithMockedKmsNet60").IsDependentOn("TestCsfleWithMockedKms"); - Task("TestCsfleWithMongocryptd") .IsDependentOn("TestLibMongoCrypt") .DoesForEach( @@ -233,10 +202,6 @@ Task("TestCsfleWithMongocryptd") action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject, filter: "Category=\"CSFLE\"")); -Task("TestCsfleWithMongocryptdNet472").IsDependentOn("TestCsfleWithMongocryptd"); -Task("TestCsfleWithMongocryptdNetStandard21").IsDependentOn("TestCsfleWithMongocryptd"); -Task("TestCsfleWithMongocryptdNet60").IsDependentOn("TestCsfleWithMongocryptd"); - Task("TestCsfleWithAzureKms") .IsDependentOn("TestLibMongoCrypt") .DoesForEach( @@ -258,8 +223,6 @@ Task("TestX509") action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject, filter: "Category=\"X509\"")); -Task("TestX509Net60").IsDependentOn("TestX509"); - Task("TestSocks5Proxy") .IsDependentOn("Build") .DoesForEach( @@ -376,12 +339,6 @@ Task("SmokeTests") }); }); -Task("SmokeTestsNet472").IsDependentOn("SmokeTests"); -Task("SmokeTestsNetCoreApp31").IsDependentOn("SmokeTests"); -Task("SmokeTestsNet50").IsDependentOn("SmokeTests"); -Task("SmokeTestsNet60").IsDependentOn("SmokeTests"); -Task("SmokeTestsNet80").IsDependentOn("SmokeTests"); - Setup( setupContext => { @@ -392,37 +349,28 @@ Setup( var unknownArchitecture => throw new Exception($"Unknown CPU architecture: {unknownArchitecture}.") }; - var lowerTarget = target.ToLowerInvariant(); - var framework = lowerTarget switch + var framework = Environment.GetEnvironmentVariable("FRAMEWORK"); + if (string.Equals(framework, "netstandard2.1", StringComparison.InvariantCultureIgnoreCase)) { - string s when s.EndsWith("netstandard21") || s.EndsWith("netcoreapp31") => "netcoreapp3.1", - string s when s.EndsWith("net472") => "net472", - string s when s.EndsWith("net50") => "net5.0", - string s when s.EndsWith("net60") => "net6.0", - string s when s.EndsWith("net80") => "net8.0", - _ => null - }; - - var isReleaseMode = lowerTarget.StartsWith("package") || lowerTarget == "release"; - var packageVersion = lowerTarget.StartsWith("smoketests") ? Environment.GetEnvironmentVariable("PACKAGE_VERSION") : gitVersion.LegacySemVer; + framework = "netcoreapp3.1"; + } - Console.WriteLine($"Framework: {framework ?? "null (not set)"}, TargetPlatform: {targetPlatform}, IsReleaseMode: {isReleaseMode}, PackageVersion: {packageVersion}"); + var packageVersion = target.ToLowerInvariant().StartsWith("smoketests") ? Environment.GetEnvironmentVariable("PACKAGE_VERSION") : gitVersion.LegacySemVer; + Console.WriteLine($"Framework: {framework ?? "null (not set)"}, TargetPlatform: {targetPlatform}, PackageVersion: {packageVersion}"); - return new BuildConfig(isReleaseMode, framework, targetPlatform, packageVersion); + return new BuildConfig(framework, targetPlatform, packageVersion); }); RunTarget(target); public class BuildConfig { - public bool IsReleaseMode { get; } public string Framework { get; } public string PackageVersion { get; } public string TargetPlatform { get; } - public BuildConfig(bool isReleaseMode, string framework, string targetPlatform, string packageVersion) + public BuildConfig(string framework, string targetPlatform, string packageVersion) { - IsReleaseMode = isReleaseMode; Framework = framework; TargetPlatform = targetPlatform; PackageVersion = packageVersion; diff --git a/build.config b/build.config index badb4438541..ef704d5f9e8 100644 --- a/build.config +++ b/build.config @@ -1,3 +1,2 @@ #!/usr/bin/env bash CAKE_VERSION=2.3.0 -DOTNET_VERSION=8.0.204 diff --git a/build.ps1 b/build.ps1 index cc4a4d4aa80..7bb2f38e769 100644 --- a/build.ps1 +++ b/build.ps1 @@ -5,20 +5,16 @@ $DotNetChannel = 'LTS' $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent [string] $CakeVersion = '' -[string] $DotNetVersion= '' foreach($line in Get-Content (Join-Path $PSScriptRoot 'build.config')) { if ($line -like 'CAKE_VERSION=*') { $CakeVersion = $line.SubString(13) } - elseif ($line -like 'DOTNET_VERSION=*') { - $DotNetVersion =$line.SubString(15) - } } -if ([string]::IsNullOrEmpty($CakeVersion) -or [string]::IsNullOrEmpty($DotNetVersion)) { - 'Failed to parse Cake / .NET Core SDK Version' +if ([string]::IsNullOrEmpty($CakeVersion)) { + 'Failed to parse Cake Version' exit 1 } @@ -46,81 +42,6 @@ if ($PSVersionTable.PSEdition -ne 'Core') { } } -########################################################################### -# INSTALL .NET CORE CLI -########################################################################### - -$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -$env:DOTNET_CLI_TELEMETRY_OPTOUT=1 -$env:DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2 - - -Function Remove-PathVariable([string]$VariableToRemove) -{ - $SplitChar = ';' - if ($IsMacOS -or $IsLinux) { - $SplitChar = ':' - } - - $path = [Environment]::GetEnvironmentVariable("PATH", "User") - if ($path -ne $null) - { - $newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "User") - } - - $path = [Environment]::GetEnvironmentVariable("PATH", "Process") - if ($path -ne $null) - { - $newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } - [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process") - } -} - -# Get .NET Core CLI path if installed. -$FoundDotNetCliVersion = $null; -if (Get-Command dotnet -ErrorAction SilentlyContinue) { - $FoundDotNetCliVersion = dotnet --version; -} - -if($FoundDotNetCliVersion -ne $DotNetVersion) { - $InstallPath = Join-Path $PSScriptRoot ".dotnet" - if (!(Test-Path $InstallPath)) { - New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null; - } - - # N.B. We explicitly install .NET Core 3.1 because .NET 5.0 SDK can build those TFMs - # but will silently upgrade to a more recent runtime to execute tests if the desired runtime - # isn't available. For example, `dotnet run --framework netcoreapp3.0` will silently run - # on .NET 5.0 if .NET Core 3.0 and 3.1 aren't installed. - # This solution is admittedly hacky as .NET Core 3.1 won't be installed if - # $DOTNET_VERSION matches $DOTNET_INSTALLED_VERSION, but it minimizes the changes required - # to install required dependencies on Evergreen. - if ($IsMacOS -or $IsLinux) { - $ScriptPath = Join-Path $InstallPath 'dotnet-install.sh' - (New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, $ScriptPath); - & bash $ScriptPath --install-dir "$InstallPath" --channel 3.1 --no-path - & bash $ScriptPath --install-dir "$InstallPath" --channel 5.0 --no-path - & bash $ScriptPath --install-dir "$InstallPath" --channel 6.0 --no-path - & bash $ScriptPath --version "$DotNetVersion" --install-dir "$InstallPath" --channel "$DotNetChannel" --no-path - - Remove-PathVariable "$InstallPath" - $env:PATH = "$($InstallPath):$env:PATH" - } - else { - $ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1' - (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath); - & $ScriptPath -Channel 3.1 -InstallDir $InstallPath; - & $ScriptPath -Channel 5.0 -InstallDir $InstallPath; - & $ScriptPath -Channel 6.0 -InstallDir $InstallPath; - & $ScriptPath -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; - - Remove-PathVariable "$InstallPath" - $env:PATH = "$InstallPath;$env:PATH" - } - $env:DOTNET_ROOT=$InstallPath -} - ########################################################################### # INSTALL CAKE ########################################################################### diff --git a/build.sh b/build.sh index a3ce5a72b9f..aa09497c943 100755 --- a/build.sh +++ b/build.sh @@ -6,8 +6,8 @@ TOOLS_DIR=$SCRIPT_DIR/tools CAKE_EXE=$TOOLS_DIR/dotnet-cake CAKE_PATH=$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION -if [ "$CAKE_VERSION" = "" ] || [ "$DOTNET_VERSION" = "" ]; then - echo "An error occured while parsing Cake / .NET Core SDK version." +if [ "$CAKE_VERSION" = "" ]; then + echo "An error occured while parsing Cake version." exit 1 fi @@ -16,48 +16,11 @@ if [ ! -d "$TOOLS_DIR" ]; then mkdir "$TOOLS_DIR" fi -########################################################################### -# INSTALL .NET CORE CLI -########################################################################### - -export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -export DOTNET_CLI_TELEMETRY_OPTOUT=1 -export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 -export DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2 - -DOTNET_INSTALLED_VERSION=$(dotnet --version 2>&1) - -if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then - echo "Installing .NET CLI..." - if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then - mkdir "$SCRIPT_DIR/.dotnet" - fi - curl -Lfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh - # N.B. We explicitly install .NET Core 3.1 because .NET 6.0 SDK can build those TFMs - # but will silently upgrade to a more recent runtime to execute tests if the desired runtime - # isn't available. For example, `dotnet run --framework netcoreapp3.0` will silently run - # on .NET 6.0 if .NET Core 3.0 and 3.1 aren't installed. - # This solution is admittedly hacky as .NET Core 3.1 won't be installed if - # $DOTNET_VERSION matches $DOTNET_INSTALLED_VERSION, but it minimizes the changes required - # to install required dependencies on Evergreen. - # Since ARM64 support was first added in .NET 6.0, the following commands will install: - # | CPU | 2.1 | 3.1 | Latest | - # | x64 | x64 | x64 | x64 | - # | arm64 | x64 | x64 | arm64 | - bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 3.1 --architecture x64 --install-dir .dotnet --no-path - bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 5.0 --architecture x64 --install-dir .dotnet --no-path - bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 6.0 --install-dir .dotnet --no-path - bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir .dotnet --no-path - export PATH="$SCRIPT_DIR/.dotnet":$PATH - export DOTNET_ROOT="$SCRIPT_DIR/.dotnet" -fi - ########################################################################### # INSTALL CAKE ########################################################################### -CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1) - +CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1) || true if [ "$CAKE_VERSION" != "$CAKE_INSTALLED_VERSION" ]; then if [ ! -f "$CAKE_EXE" ] || [ ! -d "$CAKE_PATH" ]; then if [ -f "$CAKE_EXE" ]; then diff --git a/evergreen/compile.sh b/evergreen/compile.sh deleted file mode 100755 index c7a08497898..00000000000 --- a/evergreen/compile.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit # Exit the script with error if any of the commands fail - -############################################ -# Main Program # -############################################ - -echo "Compiling .NET driver" - -if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin - for var in TMP TEMP NUGET_PACKAGES NUGET_HTTP_CACHE_PATH APPDATA; do - setx $var z:\\data\\tmp - export $var=z:\\data\\tmp - done - powershell.exe .\\build.ps1 --target Build --Verbosity Diagnostic -else - for var in TMP TEMP NUGET_PACKAGES NUGET_HTTP_CACHE_PATH APPDATA; do - export $var=/data/tmp; - done - ./build.sh --target=Build --Verbosity Diagnostic -fi diff --git a/evergreen/evergreen.yml b/evergreen/evergreen.yml index 617e84b5b30..81bcbc69949 100644 --- a/evergreen/evergreen.yml +++ b/evergreen/evergreen.yml @@ -47,13 +47,13 @@ functions: fi PACKAGE_VERSION=$(bash ./evergreen/get-version.sh) - export DOTNET_SDK_PATH="$(pwd)/../.dotnet" + export DOTNET_ROOT="$(pwd)/../.dotnet" export DRIVERS_TOOLS="$(pwd)/../drivers-tools" if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin # Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) - export DOTNET_SDK_PATH=$(cygpath -m $DOTNET_SDK_PATH) + export DOTNET_ROOT=$(cygpath -m $DOTNET_ROOT) else # non windows OSs don't have dotnet in the PATH export PATH=$PATH:/usr/share/dotnet @@ -72,7 +72,7 @@ functions: UPLOAD_BUCKET: "$UPLOAD_BUCKET" PROJECT_DIRECTORY: "$PROJECT_DIRECTORY" PACKAGE_VERSION: "$PACKAGE_VERSION" - DOTNET_SDK_PATH: "$DOTNET_SDK_PATH" + DOTNET_ROOT: "$DOTNET_ROOT" TEST_RESULTS_PATH: "./mongo-csharp-driver/build/test-results/TEST-*.xml" PREPARE_SHELL: | set -o errexit @@ -83,7 +83,8 @@ functions: export PROJECT_DIRECTORY="$PROJECT_DIRECTORY" export PACKAGE_VERSION="$PACKAGE_VERSION" export TMPDIR="$MONGO_ORCHESTRATION_HOME/db" - export PATH="$DOTNET_SDK_PATH:$MONGODB_BINARIES:$PATH" + export PATH="$DOTNET_ROOT:$MONGODB_BINARIES:$PATH" + export DOTNET_ROOT="$DOTNET_ROOT" export PROJECT="${project}" EOT # See what we've done @@ -94,8 +95,14 @@ functions: params: file: mongo-csharp-driver/expansion.yml - install-dotnet: + configure-framework: + - command: expansions.update + params: + updates: + - key: 'FRAMEWORK' + value: ${FRAMEWORK} - command: shell.exec + type: system params: include_expansions_in_env: - "OS" @@ -456,7 +463,9 @@ functions: - "AWS_ACCESS_KEY_ID" - "AWS_SECRET_ACCESS_KEY" - "AWS_SESSION_TOKEN" + - "FRAMEWORK" script: | + ${PREPARE_SHELL} . ${DRIVERS_TOOLS}/.evergreen/secrets_handling/setup-secrets.sh drivers/atlas_connect . evergreen/run-atlas-connectivity-tests.sh @@ -468,16 +477,18 @@ functions: include_expansions_in_env: - "AUTH_GSSAPI" - "AUTH_HOST" + - "FRAMEWORK" script: | - PROJECT_DIRECTORY=${PROJECT_DIRECTORY} \ - FRAMEWORK=${FRAMEWORK} \ - evergreen/run-gssapi-auth-tests.sh + ${PREPARE_SHELL} + PROJECT_DIRECTORY=${PROJECT_DIRECTORY} evergreen/run-gssapi-auth-tests.sh run-plain-auth-tests: - command: shell.exec type: test params: working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" env: MONGODB_URI: ${plain_auth_mongodb_uri} script: | @@ -553,11 +564,14 @@ functions: - command: shell.exec type: test params: + include_expansions_in_env: + - "FRAMEWORK" env: IAM_AUTH_ECS_ACCOUNT: ${iam_auth_ecs_account} IAM_AUTH_ECS_SECRET_ACCESS_KEY: ${iam_auth_ecs_secret_access_key} working_dir: mongo-csharp-driver script: | + ${PREPARE_SHELL} DRIVERS_TOOLS=${DRIVERS_TOOLS} OS=${OS} evergreen/run-mongodb-aws-test.sh regular run-aws-auth-test-with-assume-role-credentials: @@ -565,7 +579,10 @@ functions: type: test params: working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" script: | + ${PREPARE_SHELL} DRIVERS_TOOLS=${DRIVERS_TOOLS} OS=${OS} evergreen/run-mongodb-aws-test.sh assume-role run-aws-auth-test-with-aws-EC2-credentials: @@ -573,6 +590,8 @@ functions: type: test params: working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" script: | ${PREPARE_SHELL} if [ "${skip_EC2_auth_test}" = "true" ]; then @@ -587,6 +606,8 @@ functions: params: shell: "bash" working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" script: | ${PREPARE_SHELL} if [ "${skip_ECS_auth_test}" = "true" ]; then @@ -601,6 +622,7 @@ functions: # Workaround. EG_TOOLS scripts for ECS assume that a folder with EG scripts in the driver is named ".evergreen" mkdir $SRC_DIRECTORY/.evergreen cp -r $SRC_DIRECTORY/evergreen/run-mongodb-aws-ecs-test.sh $SRC_DIRECTORY/.evergreen/run-mongodb-aws-ecs-test.sh + cp -r $SRC_DIRECTORY/evergreen/install-dotnet.sh $SRC_DIRECTORY/.evergreen/install-dotnet.sh export PROJECT_DIRECTORY="$SRC_DIRECTORY" ${DRIVERS_TOOLS}/.evergreen/auth_aws/aws_setup.sh ecs @@ -609,7 +631,10 @@ functions: - command: shell.exec type: test params: + shell: "bash" working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" script: | ${PREPARE_SHELL} if [ "${skip_web_identity_auth_test}" = "true" ]; then @@ -622,6 +647,8 @@ functions: params: shell: "bash" working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" script: | ${PREPARE_SHELL} if [ "${skip_web_identity_auth_test}" = "true" ]; then @@ -635,11 +662,14 @@ functions: - command: shell.exec type: test params: + include_expansions_in_env: + - "FRAMEWORK" env: IAM_AUTH_ECS_ACCOUNT: ${iam_auth_ecs_account} IAM_AUTH_ECS_SECRET_ACCESS_KEY: ${iam_auth_ecs_secret_access_key} working_dir: mongo-csharp-driver script: | + ${PREPARE_SHELL} DRIVERS_TOOLS=${DRIVERS_TOOLS} OS=${OS} ASSERT_NO_URI_CREDS=true evergreen/run-mongodb-aws-test.sh env-creds run-aws-auth-test-with-aws-credentials-and-session-token-as-environment-variables: @@ -647,7 +677,10 @@ functions: type: test params: working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" script: | + ${PREPARE_SHELL} DRIVERS_TOOLS=${DRIVERS_TOOLS} OS=${OS} ASSERT_NO_URI_CREDS=true evergreen/run-mongodb-aws-test.sh session-creds run-atlas-search-test: @@ -659,6 +692,7 @@ functions: - "AWS_ACCESS_KEY_ID" - "AWS_SECRET_ACCESS_KEY" - "AWS_SESSION_TOKEN" + - "FRAMEWORK" script: | ${PREPARE_SHELL} . ${DRIVERS_TOOLS}/.evergreen/secrets_handling/setup-secrets.sh drivers/atlas-qa @@ -669,6 +703,8 @@ functions: type: test params: working_dir: mongo-csharp-driver + include_expansions_in_env: + - "FRAMEWORK" script: | ${PREPARE_SHELL} MONGODB_URI="${MONGODB_URI}" evergreen/run-atlas-search-index-helpers-test.sh @@ -703,7 +739,7 @@ functions: OCSP_ALGORITHM=${OCSP_ALGORITHM} SERVER_TYPE=${SERVER_TYPE} ${DRIVERS_TOOLS}/.evergreen/ocsp/setup.sh run-mongodb-oidc-tests: - - command: subprocess.exec + - command: shell.exec type: test params: working_dir: mongo-csharp-driver @@ -712,8 +748,9 @@ functions: - "DRIVERS_TOOLS" - "OS" - "FRAMEWORK" - args: - - evergreen/run-mongodb-oidc-tests.sh + script: | + ${PREPARE_SHELL} + evergreen/run-mongodb-oidc-tests.sh run-smoke-tests: - command: shell.exec @@ -1117,108 +1154,108 @@ post: tasks: - name: unit-tests-net472 commands: - - command: expansions.update - params: - updates: - - key: 'FRAMEWORK' - value: 'net472' - - func: install-dotnet + - func: configure-framework + vars: + FRAMEWORK: net472 - func: run-unit-tests - name: unit-tests-netstandard21 commands: - - command: expansions.update - params: - updates: - - key: 'FRAMEWORK' - value: 'netstandard2.1' - - func: install-dotnet + - func: configure-framework + vars: + FRAMEWORK: netstandard2.1 - func: run-unit-tests - name: unit-tests-net60 commands: - - command: expansions.update - params: - updates: - - key: 'FRAMEWORK' - value: 'net6.0' - - func: install-dotnet + - func: configure-framework + vars: + FRAMEWORK: net6.0 - func: run-unit-tests - name: test-net472 commands: - func: setup-csfle-secrets - func: bootstrap-mongo-orchestration - - func: run-tests + - func: configure-framework vars: FRAMEWORK: net472 + - func: run-tests - name: test-netstandard21 commands: - func: setup-csfle-secrets - func: bootstrap-mongo-orchestration - - func: run-tests + - func: configure-framework vars: - FRAMEWORK: netstandard21 + FRAMEWORK: netstandard2.1 + - func: run-tests - name: test-net60 commands: - func: setup-csfle-secrets - func: bootstrap-mongo-orchestration - - func: run-tests + - func: configure-framework vars: - FRAMEWORK: net60 + FRAMEWORK: net6.0 + - func: run-tests - name: test-csfle-with-mongocryptd-net472 commands: - func: setup-csfle-secrets - func: bootstrap-mongo-orchestration - - func: run-csfle-with-mongocryptd-tests + - func: configure-framework vars: FRAMEWORK: net472 + - func: run-csfle-with-mongocryptd-tests - name: test-csfle-with-mongocryptd-netstandard21 commands: - func: setup-csfle-secrets - func: bootstrap-mongo-orchestration - - func: run-csfle-with-mongocryptd-tests + - func: configure-framework vars: - FRAMEWORK: netstandard21 + FRAMEWORK: netstandard2.1 + - func: run-csfle-with-mongocryptd-tests - name: test-csfle-with-mongocryptd-net60 commands: - func: setup-csfle-secrets - func: bootstrap-mongo-orchestration - - func: run-csfle-with-mongocryptd-tests + - func: configure-framework vars: - FRAMEWORK: net60 + FRAMEWORK: net6.0 + - func: run-csfle-with-mongocryptd-tests - name: test-csfle-with-mocked-kms-tls-net472 commands: - func: setup-csfle-secrets - func: start-cse-servers - func: bootstrap-mongo-orchestration - - func: run-csfle-with-mocked-kms-tests + - func: configure-framework vars: FRAMEWORK: net472 + - func: run-csfle-with-mocked-kms-tests - name: test-csfle-with-mocked-kms-tls-netstandard21 commands: - func: setup-csfle-secrets - func: start-cse-servers - func: bootstrap-mongo-orchestration - - func: run-csfle-with-mocked-kms-tests + - func: configure-framework vars: - FRAMEWORK: netstandard21 + FRAMEWORK: netstandard2.1 + - func: run-csfle-with-mocked-kms-tests - name: test-csfle-with-mocked-kms-tls-net60 commands: - func: setup-csfle-secrets - func: start-cse-servers - func: bootstrap-mongo-orchestration - - func: run-csfle-with-mocked-kms-tests + - func: configure-framework vars: - FRAMEWORK: net60 + FRAMEWORK: net6.0 + - func: run-csfle-with-mocked-kms-tests - name: test-load-balancer-netstandard21 commands: @@ -1226,9 +1263,10 @@ tasks: vars: LOAD_BALANCER: 'true' - func: run-load-balancer - - func: run-load-balancer-tests + - func: configure-framework vars: - FRAMEWORK: netstandard21 + FRAMEWORK: netstandard2.1 + - func: run-load-balancer-tests - func: stop-load-balancer - name: test-load-balancer-net60 @@ -1237,64 +1275,73 @@ tasks: vars: LOAD_BALANCER: 'true' - func: run-load-balancer - - func: run-load-balancer-tests + - func: configure-framework vars: - FRAMEWORK: net60 + FRAMEWORK: net6.0 + - func: run-load-balancer-tests - func: stop-load-balancer - name: atlas-connectivity-tests commands: - func: assume-aws-test-secrets-role + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-atlas-connectivity-tests - - name: test-gssapi - commands: - - func: run-gssapi-auth-tests - - name: test-gssapi-net472 commands: - - func: run-gssapi-auth-tests + - func: configure-framework vars: FRAMEWORK: net472 + - func: run-gssapi-auth-tests - name: test-gssapi-netstandard21 commands: - - func: run-gssapi-auth-tests + - func: configure-framework vars: - FRAMEWORK: netstandard21 + FRAMEWORK: netstandard2.1 + - func: run-gssapi-auth-tests - name: test-gssapi-net60 commands: - - func: run-gssapi-auth-tests + - func: configure-framework vars: - FRAMEWORK: net60 + FRAMEWORK: net6.0 + - func: run-gssapi-auth-tests - name: test-socks5-proxy-net472 commands: - func: bootstrap-mongo-orchestration - func: setup-socks5-proxy - - func: run-socks5-proxy-tests + - func: configure-framework vars: FRAMEWORK: net472 + - func: run-socks5-proxy-tests - name: test-socks5-proxy-netstandard21 commands: - func: bootstrap-mongo-orchestration - func: setup-socks5-proxy - - func: run-socks5-proxy-tests + - func: configure-framework vars: FRAMEWORK: netstandard21 + - func: run-socks5-proxy-tests - name: test-socks5-proxy-net60 commands: - func: bootstrap-mongo-orchestration - func: setup-socks5-proxy - - func: run-socks5-proxy-tests + - func: configure-framework vars: FRAMEWORK: net60 + - func: run-socks5-proxy-tests - name: plain-auth-tests commands: + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-plain-auth-tests - name: aws-auth-tests @@ -1305,6 +1352,9 @@ tasks: ORCHESTRATION_FILE: "auth-aws.json" TOPOLOGY: "server" - func: add-aws-auth-variables-to-file + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use # This step also creates test related users, so don't avoid this step in order to run other tests - func: run-aws-auth-test-with-regular-aws-credentials - func: run-aws-auth-test-with-assume-role-credentials @@ -1321,9 +1371,11 @@ tasks: - func: bootstrap-mongo-orchestration vars: REQUIRE_API_VERSION: true - - func: run-tests + - func: configure-framework vars: FRAMEWORK: net472 + - func: run-tests + vars: REQUIRE_API_VERSION: true - name: stable-api-tests-netstandard21 @@ -1332,9 +1384,11 @@ tasks: - func: bootstrap-mongo-orchestration vars: REQUIRE_API_VERSION: true + - func: configure-framework + vars: + FRAMEWORK: netstandard2.1 - func: run-tests vars: - FRAMEWORK: netstandard21 REQUIRE_API_VERSION: true - name: stable-api-tests-net60 @@ -1343,22 +1397,33 @@ tasks: - func: bootstrap-mongo-orchestration vars: REQUIRE_API_VERSION: true + - func: configure-framework + vars: + FRAMEWORK: net6.0 - func: run-tests vars: - FRAMEWORK: net60 REQUIRE_API_VERSION: true - name: atlas-search-test commands: - func: assume-aws-test-secrets-role + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-atlas-search-test - name: atlas-search-index-helpers-test commands: + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-atlas-search-index-helpers-test - name: test-oidc-auth commands: + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-mongodb-oidc-tests - name: test-oidc-azure @@ -1372,7 +1437,7 @@ tasks: ${PREPARE_SHELL} dotnet build - tar czf /tmp/mongo-csharp-driver.tgz tests/*.Tests/bin/Debug/net6.0/ ./evergreen/run-mongodb-oidc-env-tests.sh + tar czf /tmp/mongo-csharp-driver.tgz tests/*.Tests/bin/Debug/net6.0/ evergreen/run-mongodb-oidc-env-tests.sh evergreen/install-dotnet.sh export AZUREOIDC_DRIVERS_TAR_FILE=/tmp/mongo-csharp-driver.tgz export AZUREOIDC_TEST_CMD="OIDC_ENV=azure ./evergreen/run-mongodb-oidc-env-tests.sh" @@ -1392,7 +1457,7 @@ tasks: cp $DRIVERS_TOOLS/.evergreen/auth_oidc/gcp/secrets-export.sh ./secrets-export.sh dotnet build - tar czf /tmp/mongo-csharp-driver.tgz tests/*.Tests/bin/Debug/net6.0/ ./evergreen/run-mongodb-oidc-env-tests.sh ./secrets-export.sh + tar czf /tmp/mongo-csharp-driver.tgz tests/*.Tests/bin/Debug/net6.0/ evergreen/run-mongodb-oidc-env-tests.sh evergreen/install-dotnet.sh secrets-export.sh export GCPOIDC_DRIVERS_TAR_FILE=/tmp/mongo-csharp-driver.tgz export GCPOIDC_TEST_CMD="OIDC_ENV=gcp ./evergreen/run-mongodb-oidc-env-tests.sh" @@ -1407,7 +1472,7 @@ tasks: script: |- ${PREPARE_SHELL} dotnet build - tar czf /tmp/mongo-csharp-driver.tgz tests/*.Tests/bin/Debug/net6.0/ ./evergreen/run-mongodb-oidc-env-tests.sh + tar czf /tmp/mongo-csharp-driver.tgz tests/*.Tests/bin/Debug/net6.0/ evergreen/run-mongodb-oidc-env-tests.sh evergreen/install-dotnet.sh - func: assume-aws-test-secrets-role - func: run_oidc_k8s_tests vars: @@ -1429,6 +1494,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1444,6 +1512,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1459,6 +1530,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1474,6 +1548,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1485,6 +1562,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1500,6 +1580,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1511,6 +1594,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1526,6 +1612,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1541,6 +1630,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1556,6 +1648,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1571,6 +1666,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1586,6 +1684,9 @@ tasks: - func: bootstrap-mongo-orchestration vars: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple-disableStapling.json" + - func: configure-framework + vars: + FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1593,6 +1694,7 @@ tasks: - name: test-smoke-tests commands: + - func: configure-framework - func: bootstrap-mongo-orchestration - func: run-smoke-tests @@ -1605,7 +1707,7 @@ tasks: SSL: "nossl" AUTH: "noauth" SKIP_LEGACY_SHELL: "true" - - func: install-dotnet + - func: configure-framework - func: run-performance-tests - name: test-aws-lambda-deployed @@ -1614,9 +1716,7 @@ tasks: params: role_arn: ${LAMBDA_AWS_ROLE_ARN} duration_seconds: 3600 - - func: install-dotnet - vars: - DOTNET_SDK_VERSION: 8.0 + - func: configure-framework - command: shell.exec params: working_dir: mongo-csharp-driver @@ -1689,18 +1789,18 @@ tasks: - name: test-SK commands: - - func: install-dotnet + - func: configure-framework - func: run-test-SK - name: build-packages commands: - - func: install-dotnet + - func: configure-framework - func: build-packages - func: upload-packages - name: validate-apicompat commands: - - func: install-dotnet + - func: configure-framework vars: DOTNET_SDK_VERSION: 6.0 - func: download-packages @@ -1715,7 +1815,7 @@ tasks: - name: push-packages-nuget commands: - - func: install-dotnet + - func: configure-framework - func: download-packages - func: sign-packages - func: push-packages @@ -1725,7 +1825,7 @@ tasks: - name: push-packages-myget commands: - - func: install-dotnet + - func: configure-framework - func: download-packages - func: sign-packages - func: push-packages @@ -1735,7 +1835,7 @@ tasks: - name: generate-apidocs commands: - - func: install-dotnet + - func: configure-framework - func: build-apidocs - func: upload-apidocs @@ -1755,7 +1855,7 @@ tasks: - name: validate-apidocs commands: - - func: install-dotnet + - func: configure-framework - func: build-apidocs - name: test-odata @@ -1772,7 +1872,7 @@ tasks: LOCAL_PATH: ${workdir}/odata SCRIPT: | ${PREPARE_SHELL} - DOTNET_SDK_PATH="${DOTNET_SDK_PATH}" bash ./evergreen/install-dependencies.sh + DOTNET_SDK_PATH="${DOTNET_ROOT}" bash ./evergreen/install-dependencies.sh DRIVER_VERSION="${PACKAGE_VERSION}" bash ./evergreen/run-tests.sh - name: test-analyzer @@ -1788,12 +1888,12 @@ tasks: LOCAL_PATH: ${workdir}/analyzer SCRIPT: | ${PREPARE_SHELL} - DOTNET_SDK_PATH="${DOTNET_SDK_PATH}" bash ./evergreen/install-dependencies.sh + DOTNET_SDK_PATH="${DOTNET_ROOT}" bash ./evergreen/install-dependencies.sh DRIVER_VERSION="${PACKAGE_VERSION}" TARGET_FRAMEWORK=netcoreapp3.1 bash ./evergreen/run-tests.sh - name: test-efcore commands: - - func: install-dotnet + - func: configure-framework vars: DOTNET_SDK_VERSION: 9.0 FRAMEWORK: net8.0 @@ -1819,9 +1919,10 @@ tasks: commands: - func: assume-aws-test-secrets-role - func: setup-x509-tests - - func: run-x509-tests + - func: configure-framework vars: - FRAMEWORK: net60 + FRAMEWORK: net6.0 + - func: run-x509-tests axes: - id: version @@ -1961,13 +2062,13 @@ axes: variables: FRAMEWORK: net472 - id: "netstandard21" - display_name: netstandard21 + display_name: netstandard2.1 variables: - FRAMEWORK: netstandard21 + FRAMEWORK: netstandard2.1 - id: "net60" - display_name: net60 + display_name: net6.0 variables: - FRAMEWORK: net60 + FRAMEWORK: net6.0 - id: runtime_framework display_name: Runtime .net @@ -1977,16 +2078,16 @@ axes: FRAMEWORK: net472 - id: "netcoreapp31" variables: - FRAMEWORK: netcoreapp31 + FRAMEWORK: netcoreapp3.1 - id: "net50" variables: - FRAMEWORK: net50 + FRAMEWORK: net5.0 - id: "net60" variables: - FRAMEWORK: net60 + FRAMEWORK: net6.0 - id: "net80" variables: - FRAMEWORK: net80 + FRAMEWORK: net8.0 task_groups: - name: testazurekms-task-group @@ -2185,7 +2286,7 @@ task_groups: - func: fix-absolute-paths - func: make-files-executable - func: assume-aws-test-secrets-role - - func: install-dotnet + - func: configure-framework - command: subprocess.exec params: binary: bash @@ -2216,7 +2317,7 @@ task_groups: - func: fix-absolute-paths - func: make-files-executable - func: assume-aws-test-secrets-role - - func: install-dotnet + - func: configure-framework - command: subprocess.exec params: binary: bash @@ -2245,8 +2346,8 @@ task_groups: - func: prepare-resources - func: fix-absolute-paths - func: make-files-executable - - func: install-dotnet - func: assume-aws-test-secrets-role + - func: configure-framework - command: subprocess.exec params: binary: bash @@ -2273,7 +2374,7 @@ task_groups: - func: prepare-resources - func: fix-absolute-paths - func: make-files-executable - - func: install-dotnet + - func: configure-framework teardown_group: - command: s3.put params: @@ -2576,14 +2677,14 @@ buildvariants: - name: atlas-connectivity-tests display_name: "Atlas Connectivity Tests" run_on: - - windows-64-vs2017-test + - windows-64-vs2017-test # Why on windows? tasks: - name: atlas-connectivity-tests - name: atlas-search-test display_name: "Atlas Search Tests" run_on: - - windows-64-vs2017-test + - windows-64-vs2017-test # Why on windows? tasks: - name: atlas-search-test diff --git a/evergreen/install-dotnet.sh b/evergreen/install-dotnet.sh index 2798a24c15f..d9c1b67b043 100644 --- a/evergreen/install-dotnet.sh +++ b/evergreen/install-dotnet.sh @@ -1,37 +1,46 @@ #!/usr/bin/env bash set -o errexit # Exit the script with error if any of the commands fail -DOTNET_SDK_PATH="${DOTNET_SDK_PATH:-./.dotnet}" +DOTNET_ROOT="${DOTNET_ROOT:-./.dotnet}" DOTNET_SDK_VERSION="${DOTNET_SDK_VERSION:-8.0}" echo "runtime: $FRAMEWORK" if [ -n "$FRAMEWORK" ]; then - if [ "$FRAMEWORK" = "net6.0" ]; then + if [ "$FRAMEWORK" = "net5.0" ]; then + RUNTIME_VERSION="5.0" + elif [ "$FRAMEWORK" = "net6.0" ]; then RUNTIME_VERSION="6.0" elif [ "$FRAMEWORK" = "net8.0" ]; then - RUNTIME_VERSION="8.0" + RUNTIME_VERSION="8.0" elif [ "$FRAMEWORK" = "netstandard2.1" ]; then RUNTIME_VERSION="3.1" + elif [ "$FRAMEWORK" = "netcoreapp3.1" ]; then + RUNTIME_VERSION="3.1" fi fi if [[ $OS =~ [Ww]indows.* ]]; then - echo "Downloading Windows .NET SDK installer into $DOTNET_SDK_PATH folder..." + echo "Downloading Windows .NET SDK installer into $DOTNET_ROOT folder..." curl -Lfo ./dotnet-install.ps1 https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1 echo "Installing .NET ${DOTNET_SDK_VERSION} SDK..." - powershell.exe ./dotnet-install.ps1 -Channel "$DOTNET_SDK_VERSION" -InstallDir "$DOTNET_SDK_PATH" -NoPath + powershell.exe ./dotnet-install.ps1 -Channel "$DOTNET_SDK_VERSION" -InstallDir "$DOTNET_ROOT" -NoPath if [ -n "$RUNTIME_VERSION" ]; then echo "Installing .NET ${RUNTIME_VERSION} runtime..." - powershell.exe ./dotnet-install.ps1 -Channel "$RUNTIME_VERSION" -Runtime dotnet -InstallDir "$DOTNET_SDK_PATH" -NoPath + powershell.exe ./dotnet-install.ps1 -Channel "$RUNTIME_VERSION" -Runtime dotnet -InstallDir "$DOTNET_ROOT" -NoPath fi else - echo "Downloading .NET SDK installer into $DOTNET_SDK_PATH folder..." + echo "Downloading .NET SDK installer into $DOTNET_ROOT folder..." curl -Lfo ./dotnet-install.sh https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh echo "Installing .NET ${DOTNET_SDK_VERSION} SDK..." - bash ./dotnet-install.sh --channel "$DOTNET_SDK_VERSION" --install-dir "$DOTNET_SDK_PATH" --no-path + bash ./dotnet-install.sh --channel "$DOTNET_SDK_VERSION" --install-dir "$DOTNET_ROOT" --no-path if [ -n "$RUNTIME_VERSION" ]; then echo "Installing .NET ${RUNTIME_VERSION} runtime..." - bash ./dotnet-install.sh --channel "$RUNTIME_VERSION" --runtime dotnet --install-dir "$DOTNET_SDK_PATH" --no-path + bash ./dotnet-install.sh --channel "$RUNTIME_VERSION" --runtime dotnet --install-dir "$DOTNET_ROOT" --no-path fi fi + +DOTNET_ROOT=$(cd "$DOTNET_ROOT" && pwd) # converts relative path to absolute + +export PATH="$DOTNET_ROOT:$PATH" +export DOTNET_ROOT="$DOTNET_ROOT" diff --git a/evergreen/run-csfle-azure-tests.sh b/evergreen/run-csfle-azure-tests.sh index 58614af1b56..bcba31e3b86 100644 --- a/evergreen/run-csfle-azure-tests.sh +++ b/evergreen/run-csfle-azure-tests.sh @@ -21,4 +21,7 @@ echo "Running Azure Credential Acquisition Test" export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 export CSFLE_AZURE_KMS_TESTS_ENABLED=true -./build.sh --target=TestCsfleWithAzureKms +export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +. ./evergreen/install-dotnet.sh + +. ./build.sh --target=TestCsfleWithAzureKms diff --git a/evergreen/run-csfle-gcp-tests.sh b/evergreen/run-csfle-gcp-tests.sh index 6eb56d87e10..181f419fa10 100644 --- a/evergreen/run-csfle-gcp-tests.sh +++ b/evergreen/run-csfle-gcp-tests.sh @@ -14,4 +14,7 @@ echo "Running GCP Credential Acquisition Test" export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 export CSFLE_GCP_KMS_TESTS_ENABLED=true -./build.sh --target=TestCsfleWithGcpKms +export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +. ./evergreen/install-dotnet.sh + +. ./build.sh --target=TestCsfleWithGcpKms diff --git a/evergreen/run-gssapi-auth-tests.sh b/evergreen/run-gssapi-auth-tests.sh index f716ae7263a..e58389021c8 100755 --- a/evergreen/run-gssapi-auth-tests.sh +++ b/evergreen/run-gssapi-auth-tests.sh @@ -17,8 +17,6 @@ echo "Running GSSAPI authentication tests" export GSSAPI_TESTS_ENABLED=true -TARGET="TestGssapi${FRAMEWORK}" - if [ "Windows_NT" = "$OS" ]; then cmd /c "REG ADD HKLM\SYSTEM\ControlSet001\Control\Lsa\Kerberos\Domains\LDAPTEST.10GEN.CC /v KdcNames /d ldaptest.10gen.cc /t REG_MULTI_SZ /f" echo "LDAPTEST.10GEN.CC registry has been added" @@ -31,7 +29,7 @@ if [ "Windows_NT" = "$OS" ]; then export $var=z:\\data\\tmp done - powershell.exe .\\build.ps1 --target $TARGET + powershell.exe .\\build.ps1 --target TestGssapi else echo "Setting krb5 config file" touch ${PROJECT_DIRECTORY}/evergreen/krb5.conf.empty @@ -47,5 +45,5 @@ else export $var=/data/tmp; done - ./build.sh --target=$TARGET + ./build.sh --target=TestGssapi fi; diff --git a/evergreen/run-load-balancer-tests.sh b/evergreen/run-load-balancer-tests.sh index 7935521eb86..521faaa639d 100644 --- a/evergreen/run-load-balancer-tests.sh +++ b/evergreen/run-load-balancer-tests.sh @@ -21,12 +21,12 @@ if [[ ! "$OS" =~ Ubuntu|ubuntu ]]; then fi -if [ "$SSL" != "nossl" ]; then +if [ "$SSL" != "nossl" ]; then SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI}&ssl=true&tlsDisableCertificateRevocationCheck=true" - MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI}&ssl=true&tlsDisableCertificateRevocationCheck=true" + MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI}&ssl=true&tlsDisableCertificateRevocationCheck=true" fi -echo "Running $AUTH tests (${FRAMEWORK}) over $SSL and connecting to SINGLE_MONGOS_LB_URI: $SINGLE_MONGOS_LB_URI or MULTI_MONGOS_LB_URI: $MULTI_MONGOS_LB_URI" +echo "Running $AUTH tests (${FRAMEWORK}) over $SSL and connecting to SINGLE_MONGOS_LB_URI: $SINGLE_MONGOS_LB_URI or MULTI_MONGOS_LB_URI: $MULTI_MONGOS_LB_URI" export MONGODB_URI=${SINGLE_MONGOS_LB_URI} export MONGODB_URI_WITH_MULTIPLE_MONGOSES=${MULTI_MONGOS_LB_URI} @@ -34,4 +34,4 @@ export MONGODB_URI_WITH_MULTIPLE_MONGOSES=${MULTI_MONGOS_LB_URI} # show test output set -x -./build.sh --target TestLoadBalanced${FRAMEWORK} +./build.sh --target TestLoadBalanced diff --git a/evergreen/run-mongodb-aws-ecs-test.sh b/evergreen/run-mongodb-aws-ecs-test.sh index 0c0aafb2b0d..2807eac8787 100644 --- a/evergreen/run-mongodb-aws-ecs-test.sh +++ b/evergreen/run-mongodb-aws-ecs-test.sh @@ -21,6 +21,9 @@ if [[ -z "$1" ]]; then fi export MONGODB_URI="$1" +export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +. src/.evergreen/install-dotnet.sh # there is a script to rename our evergreen folder into .evergreen as it is expected by eg-tools script + if echo "$MONGODB_URI" | grep -q "@"; then echo "MONGODB_URI unexpectedly contains user credentials in ECS test!"; exit 1 @@ -28,7 +31,7 @@ fi export AWS_TESTS_ENABLED=true export AWS_ECS_ENABLED=true -# EG scripts for ECS assume that a root folder is "src" and all driver side scripts are placed in ".evergreen" folder. +# EG scripts for ECS assume that a root folder is "src" and all driver side scripts are placed in ".evergreen" folder. # So that script is copied into "src/.evergreen" before running cd src diff --git a/evergreen/run-mongodb-oidc-env-tests.sh b/evergreen/run-mongodb-oidc-env-tests.sh index 33438148fd0..b8c1143f80e 100644 --- a/evergreen/run-mongodb-oidc-env-tests.sh +++ b/evergreen/run-mongodb-oidc-env-tests.sh @@ -3,13 +3,8 @@ # Don't trace since the URI contains a password that shouldn't show up in the logs set -o errexit # Exit the script with error if any of the commands fail -DOTNET_SDK_PATH="$(pwd)/.dotnet" - -echo "Downloading .NET SDK installer into $DOTNET_SDK_PATH folder..." -curl -Lfo ./dotnet-install.sh https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh -echo "Installing .NET 6.0 SDK..." -bash ./dotnet-install.sh --channel 6.0 --install-dir "$DOTNET_SDK_PATH" --no-path -export PATH=$DOTNET_SDK_PATH:$PATH +export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +. ./evergreen/install-dotnet.sh if [ "$OIDC_ENV" == "azure" ]; then source ./env.sh diff --git a/evergreen/run-tests.sh b/evergreen/run-tests.sh index 6ec9620ff3b..9386cb44161 100755 --- a/evergreen/run-tests.sh +++ b/evergreen/run-tests.sh @@ -103,10 +103,6 @@ if [ ! -z "$REQUIRE_API_VERSION" ]; then echo "Server API version is set to $MONGODB_API_VERSION" fi -if [[ $FRAMEWORK != "nil" ]] && [[ $TARGET != *${FRAMEWORK} ]]; then - TARGET="${TARGET}${FRAMEWORK}" -fi - export TARGET if [[ "$OS" =~ Windows|windows ]]; then if [ "$OCSP_TLS_SHOULD_SUCCEED" != "nil" ]; then From e819acb4b6c6ba9253b75d9c0f0ac43117816eed Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Fri, 17 Oct 2025 16:33:59 -0700 Subject: [PATCH 2/2] remove comments --- evergreen/evergreen.yml | 36 +++++++++++----------- evergreen/run-csfle-azure-tests.sh | 2 +- evergreen/run-csfle-gcp-tests.sh | 2 +- evergreen/run-deployed-lambda-aws-tests.sh | 5 +-- evergreen/run-mongodb-aws-ecs-test.sh | 2 +- evergreen/run-mongodb-oidc-env-tests.sh | 2 +- 6 files changed, 23 insertions(+), 26 deletions(-) diff --git a/evergreen/evergreen.yml b/evergreen/evergreen.yml index 81bcbc69949..30665c05e1c 100644 --- a/evergreen/evergreen.yml +++ b/evergreen/evergreen.yml @@ -1286,7 +1286,7 @@ tasks: - func: assume-aws-test-secrets-role - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-atlas-connectivity-tests - name: test-gssapi-net472 @@ -1341,7 +1341,7 @@ tasks: commands: - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-plain-auth-tests - name: aws-auth-tests @@ -1354,7 +1354,7 @@ tasks: - func: add-aws-auth-variables-to-file - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 # This step also creates test related users, so don't avoid this step in order to run other tests - func: run-aws-auth-test-with-regular-aws-credentials - func: run-aws-auth-test-with-assume-role-credentials @@ -1409,21 +1409,21 @@ tasks: - func: assume-aws-test-secrets-role - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-atlas-search-test - name: atlas-search-index-helpers-test commands: - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-atlas-search-index-helpers-test - name: test-oidc-auth commands: - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-mongodb-oidc-tests - name: test-oidc-azure @@ -1496,7 +1496,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1514,7 +1514,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1532,7 +1532,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1550,7 +1550,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1564,7 +1564,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1582,7 +1582,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1596,7 +1596,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1614,7 +1614,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1632,7 +1632,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1650,7 +1650,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1668,7 +1668,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" @@ -1686,7 +1686,7 @@ tasks: ORCHESTRATION_FILE: "rsa-basic-tls-ocsp-mustStaple-disableStapling.json" - func: configure-framework vars: - FRAMEWORK: net6.0 # TODO: discuss what frameworks should we use + FRAMEWORK: net6.0 - func: run-ocsp-test vars: OCSP_ALGORITHM: "rsa" diff --git a/evergreen/run-csfle-azure-tests.sh b/evergreen/run-csfle-azure-tests.sh index bcba31e3b86..c2a0e343fd0 100644 --- a/evergreen/run-csfle-azure-tests.sh +++ b/evergreen/run-csfle-azure-tests.sh @@ -21,7 +21,7 @@ echo "Running Azure Credential Acquisition Test" export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 export CSFLE_AZURE_KMS_TESTS_ENABLED=true -export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +export FRAMEWORK=net6.0 . ./evergreen/install-dotnet.sh . ./build.sh --target=TestCsfleWithAzureKms diff --git a/evergreen/run-csfle-gcp-tests.sh b/evergreen/run-csfle-gcp-tests.sh index 181f419fa10..ee3803ee555 100644 --- a/evergreen/run-csfle-gcp-tests.sh +++ b/evergreen/run-csfle-gcp-tests.sh @@ -14,7 +14,7 @@ echo "Running GCP Credential Acquisition Test" export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 export CSFLE_GCP_KMS_TESTS_ENABLED=true -export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +export FRAMEWORK=net6.0 . ./evergreen/install-dotnet.sh . ./build.sh --target=TestCsfleWithGcpKms diff --git a/evergreen/run-deployed-lambda-aws-tests.sh b/evergreen/run-deployed-lambda-aws-tests.sh index 75cb935cb7a..878f5a855d7 100755 --- a/evergreen/run-deployed-lambda-aws-tests.sh +++ b/evergreen/run-deployed-lambda-aws-tests.sh @@ -5,7 +5,4 @@ set -o errexit # Exit the script with error if any of the commands fail # SAM CLI installs the "Amazon.Lambda.Tools" tool in this location so we need to add it to our PATH export PATH="$PATH:$HOME/.dotnet/tools" -# setting this as SAM CLI seems to check DOTNET_ROOT directly instead of the PATH -export DOTNET_ROOT=$DOTNET_SDK_PATH - -. ${DRIVERS_TOOLS}/.evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh \ No newline at end of file +. ${DRIVERS_TOOLS}/.evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh diff --git a/evergreen/run-mongodb-aws-ecs-test.sh b/evergreen/run-mongodb-aws-ecs-test.sh index 2807eac8787..9c6395e8978 100644 --- a/evergreen/run-mongodb-aws-ecs-test.sh +++ b/evergreen/run-mongodb-aws-ecs-test.sh @@ -21,7 +21,7 @@ if [[ -z "$1" ]]; then fi export MONGODB_URI="$1" -export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +export FRAMEWORK=net6.0 . src/.evergreen/install-dotnet.sh # there is a script to rename our evergreen folder into .evergreen as it is expected by eg-tools script if echo "$MONGODB_URI" | grep -q "@"; then diff --git a/evergreen/run-mongodb-oidc-env-tests.sh b/evergreen/run-mongodb-oidc-env-tests.sh index b8c1143f80e..e926f06ea30 100644 --- a/evergreen/run-mongodb-oidc-env-tests.sh +++ b/evergreen/run-mongodb-oidc-env-tests.sh @@ -3,7 +3,7 @@ # Don't trace since the URI contains a password that shouldn't show up in the logs set -o errexit # Exit the script with error if any of the commands fail -export FRAMEWORK=net6.0 # TODO: discuss what frameworks should we use +export FRAMEWORK=net6.0 . ./evergreen/install-dotnet.sh if [ "$OIDC_ENV" == "azure" ]; then