From 4c88f33a0f41301b139ca7ab3b7afaedeb869374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Thu, 10 Apr 2025 13:43:16 +0200 Subject: [PATCH 1/8] Fix `readPreference` option in benchmark (#1664) --- .github/workflows/generator.yml | 2 +- benchmark/src/Extension/EnvironmentProvider.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generator.yml b/.github/workflows/generator.yml index 9fea10b56..786298fe3 100644 --- a/.github/workflows/generator.yml +++ b/.github/workflows/generator.yml @@ -16,7 +16,7 @@ env: DRIVER_VERSION: "mongodb/mongo-php-driver@v1.21" jobs: - psalm: + diff: name: "Diff check" runs-on: "ubuntu-22.04" diff --git a/benchmark/src/Extension/EnvironmentProvider.php b/benchmark/src/Extension/EnvironmentProvider.php index a587fead3..c313fab4d 100644 --- a/benchmark/src/Extension/EnvironmentProvider.php +++ b/benchmark/src/Extension/EnvironmentProvider.php @@ -62,7 +62,7 @@ private function getBuildInfo(Manager $manager): array $buildInfo = $manager->executeCommand( Utils::getDatabaseName(), new Command(['buildInfo' => 1]), - new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => new ReadPreference(ReadPreference::PRIMARY)], )->toArray()[0]; return [ From 8cb63f04a8b52e77dd47b736c23b859f93ed91b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Fri, 11 Apr 2025 15:58:48 +0200 Subject: [PATCH 2/8] PHPLIB-1662 Update GHA test jobs to newer ubuntu version (#1669) * PHPLIB-1662 Update GHA test jobs to ubuntu-22.04 * Run only MongoDB versions supported by ubuntu-22.04 * Use a PHP extension cache unique per driver version * Update ubuntu versions for other jobs --- .github/actions/setup/action.yml | 2 +- .github/workflows/coding-standards.yml | 4 ++-- .github/workflows/generator.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- .github/workflows/tests.yml | 20 ++++++++++---------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 48d916394..c66c0fa8f 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -24,7 +24,7 @@ runs: with: php-version: ${{ inputs.php-version }} extensions: "mongodb-${{ inputs.driver-version }}" - key: "extcache-v1" + key: "extcache-${{ inputs.driver-version }}" - name: Cache extensions uses: actions/cache@v4 diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 5552b1b6b..27bf72a6c 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -18,7 +18,7 @@ env: jobs: phpcs: name: "phpcs" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: "Checkout" @@ -36,7 +36,7 @@ jobs: rector: name: "Rector" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: "Checkout" diff --git a/.github/workflows/generator.yml b/.github/workflows/generator.yml index 786298fe3..ba60d56e3 100644 --- a/.github/workflows/generator.yml +++ b/.github/workflows/generator.yml @@ -18,7 +18,7 @@ env: jobs: diff: name: "Diff check" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: "Checkout" diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 849ed7e7b..e84d33d5b 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -24,7 +24,7 @@ env: jobs: psalm: name: "Psalm" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: "Checkout" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b43d76c60..58bcd0c85 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,36 +23,36 @@ jobs: fail-fast: true matrix: os: - - "ubuntu-20.04" + - "ubuntu-22.04" php-version: - "8.1" - "8.2" - "8.3" - "8.4" mongodb-version: - - "4.4" + - "6.0" topology: - "server" include: - - os: "ubuntu-20.04" + - os: "ubuntu-22.04" php-version: "8.1" mongodb-version: "6.0" topology: "replica_set" - - os: "ubuntu-20.04" + - os: "ubuntu-22.04" php-version: "8.1" mongodb-version: "6.0" topology: "sharded_cluster" - - os: "ubuntu-20.04" + - os: "ubuntu-24.04" php-version: "8.1" - mongodb-version: "5.0" + mongodb-version: "8.0" topology: "server" - - os: "ubuntu-20.04" + - os: "ubuntu-24.04" php-version: "8.1" - mongodb-version: "4.4" + mongodb-version: "8.0" topology: "replica_set" - - os: "ubuntu-20.04" + - os: "ubuntu-24.04" php-version: "8.1" - mongodb-version: "4.4" + mongodb-version: "8.0" topology: "sharded_cluster" steps: From fb48cce366ed7ef48d1c4c3fcc72433c0e9f240c Mon Sep 17 00:00:00 2001 From: Ahmad Shah <112424973+MAhmadShah@users.noreply.github.com> Date: Wed, 7 May 2025 07:17:41 -0400 Subject: [PATCH 3/8] Replace perf.send in Evergreen scripts (#1681) --- .evergreen/config/test-tasks.yml | 33 ++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.evergreen/config/test-tasks.yml b/.evergreen/config/test-tasks.yml index 51631e78c..5519561c4 100644 --- a/.evergreen/config/test-tasks.yml +++ b/.evergreen/config/test-tasks.yml @@ -36,6 +36,35 @@ tasks: TOPOLOGY: "server" MONGODB_VERSION: "v6.0-perf" - func: "run benchmark" - - command: perf.send + - command: shell.exec params: - file: src/benchmark/.phpbench/results.json + script: | + # We use the requester expansion to determine whether the data is from a mainline evergreen run or not + if [ "${requester}" == "commit" ]; then + is_mainline=true + else + is_mainline=false + fi + + # We parse the username out of the order_id as patches append that in and SPS does not need that information + parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}') + + # Submit the performance data to the SPS endpoint + response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \ + "https://performance-monitoring-api.corp.mongodb.com/raw_perf_results/cedar_report?project=${project_id}&version=${version_id}&variant=${build_variant}&order=$parsed_order_id&task_name=${task_name}&task_id=${task_id}&execution=${execution}&mainline=$is_mainline" \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -d @src/benchmark/.phpbench/results.json) + + http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}') + response_body=$(echo "$response" | sed '/HTTP_STATUS/d') + + # We want to throw an error if the data was not successfully submitted + if [ "$http_status" -ne 200 ]; then + echo "Error: Received HTTP status $http_status" + echo "Response Body: $response_body" + exit 1 + fi + + echo "Response Body: $response_body" + echo "HTTP Status: $http_status" From 36294dfc195baafcdad04c01e3d9b374f38fb8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Fri, 9 May 2025 15:19:10 +0200 Subject: [PATCH 4/8] Test next next minor PHP version with PHP 8.4 (#1685) --- .evergreen/config/generate-config.php | 6 ++--- .../config/generated/test-variant/phpc.yml | 24 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) mode change 100644 => 100755 .evergreen/config/generate-config.php diff --git a/.evergreen/config/generate-config.php b/.evergreen/config/generate-config.php old mode 100644 new mode 100755 index 82a1d701a..1b455988e --- a/.evergreen/config/generate-config.php +++ b/.evergreen/config/generate-config.php @@ -1,4 +1,4 @@ -#!/bin/env php +#!/usr/bin/env php Date: Fri, 23 May 2025 10:35:06 +0200 Subject: [PATCH 5/8] PHPLIB-1678: Use assume_role command before accessing secrets (#1696) --- .evergreen/config/test-task-groups.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.evergreen/config/test-task-groups.yml b/.evergreen/config/test-task-groups.yml index a8edffa41..4a83bac2c 100644 --- a/.evergreen/config/test-task-groups.yml +++ b/.evergreen/config/test-task-groups.yml @@ -8,6 +8,9 @@ task_groups: - func: "locate PHP binaries" - func: "fetch extension" - func: "install composer" + - command: ec2.assume_role + params: + role_arn: ${aws_test_secrets_role} - command: subprocess.exec params: working_dir: src From 69db1adab299daaa10bff035b4a2001628b4e6a8 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 23 May 2025 10:56:30 +0200 Subject: [PATCH 6/8] Use assume_role command before accessing secrets for atlas-data-lake tests --- .evergreen/config/test-tasks.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.evergreen/config/test-tasks.yml b/.evergreen/config/test-tasks.yml index 5519561c4..83b301c08 100644 --- a/.evergreen/config/test-tasks.yml +++ b/.evergreen/config/test-tasks.yml @@ -25,6 +25,9 @@ tasks: - name: "test-atlas-data-lake" commands: + - command: ec2.assume_role + params: + role_arn: ${aws_test_secrets_role} - func: "bootstrap mongohoused" - func: "run atlas data lake test" From fd63d23d61703e2357b5bbdbe10f4dbbacf4fe70 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 26 May 2025 10:43:33 +0200 Subject: [PATCH 7/8] PHPLIB-1678: Fix failing builds (#1702) * Use assume_role command before accessing secrets for atlas-data-lake tests * Increase task timeout to 30 minutes * Include AWS expansions when pulling mongohoused image --- .evergreen/config.yml | 4 ++-- .evergreen/config/functions.yml | 1 + .evergreen/config/test-tasks.yml | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 2c7fcb3b9..490093811 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -9,9 +9,9 @@ command_type: system # Fail builds when pre tasks fail. pre_error_fails_task: true -# Protect ourselves against rogue test case that runs forever. Tasks are killed after 20 minutes, which shouldn't occur +# Protect ourselves against rogue test case that runs forever. Tasks are killed after 30 minutes, which shouldn't occur # under normal circumstances. -exec_timeout_secs: 1200 +exec_timeout_secs: 1800 # These pre and post rules apply to all tasks not part of a task group, which should only ever be tests against local # MongoDB instances. All other tasks that require special preparation should be run from within a task group diff --git a/.evergreen/config/functions.yml b/.evergreen/config/functions.yml index 4fc2ba686..2312b7afa 100644 --- a/.evergreen/config/functions.yml +++ b/.evergreen/config/functions.yml @@ -158,6 +158,7 @@ functions: "bootstrap mongohoused": - command: shell.exec params: + include_expansions_in_env: [AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN] script: | cd ${DRIVERS_TOOLS}/.evergreen/atlas_data_lake diff --git a/.evergreen/config/test-tasks.yml b/.evergreen/config/test-tasks.yml index 5519561c4..83b301c08 100644 --- a/.evergreen/config/test-tasks.yml +++ b/.evergreen/config/test-tasks.yml @@ -25,6 +25,9 @@ tasks: - name: "test-atlas-data-lake" commands: + - command: ec2.assume_role + params: + role_arn: ${aws_test_secrets_role} - func: "bootstrap mongohoused" - func: "run atlas data lake test" From c5b87c0ecc10b42be8a254fb0b2cb03dd49ce319 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 26 May 2025 15:21:49 +0200 Subject: [PATCH 8/8] PHPLIB-1674: Fix timeouts in CSE custom endpoint test (#1706) --- tests/SpecTests/ClientSideEncryptionSpecTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/SpecTests/ClientSideEncryptionSpecTest.php b/tests/SpecTests/ClientSideEncryptionSpecTest.php index b4d2986e2..8a8735547 100644 --- a/tests/SpecTests/ClientSideEncryptionSpecTest.php +++ b/tests/SpecTests/ClientSideEncryptionSpecTest.php @@ -762,7 +762,7 @@ public function testCustomEndpoint(Closure $test): void 'kmsProviders' => [ 'azure' => Context::getAzureCredentials() + ['identityPlatformEndpoint' => 'doesnotexist.invalid:443'], 'gcp' => Context::getGCPCredentials() + ['endpoint' => 'doesnotexist.invalid:443'], - 'kmip' => ['endpoint' => 'doesnotexist.local:5698'], + 'kmip' => ['endpoint' => 'doesnotexist.invalid:5698'], ], 'tlsOptions' => [ 'kmip' => Context::getKmsTlsOptions(), @@ -810,9 +810,9 @@ static function (self $test, ClientEncryption $clientEncryption, ClientEncryptio ]; yield 'Test 4' => [ - static function (self $test, ClientEncryption $clientEncryption, ClientEncryption $clientEncryptionInvalid) use ($awsMasterKey): void { + static function (self $test, ClientEncryption $clientEncryption, ClientEncryption $clientEncryptionInvalid) use ($kmipMasterKey): void { $test->expectException(ConnectionException::class); - $clientEncryption->createDataKey('aws', ['masterKey' => $awsMasterKey + ['endpoint' => 'kms.us-east-1.amazonaws.com:12345']]); + $clientEncryption->createDataKey('kmip', ['masterKey' => $kmipMasterKey + ['endpoint' => 'localhost:12345']]); }, ]; @@ -873,7 +873,7 @@ static function (self $test, ClientEncryption $clientEncryption, ClientEncryptio $test->assertSame('test', $clientEncryption->decrypt($encrypted)); $test->expectException(RuntimeException::class); - $test->expectExceptionMessageMatches('#doesnotexist.local#'); + $test->expectExceptionMessageMatches('#doesnotexist.invalid#'); $clientEncryptionInvalid->createDataKey('kmip', ['masterKey' => $kmipMasterKey]); }, ]; @@ -890,10 +890,10 @@ static function (self $test, ClientEncryption $clientEncryption, ClientEncryptio yield 'Test 12' => [ static function (self $test, ClientEncryption $clientEncryption, ClientEncryption $clientEncryptionInvalid) use ($kmipMasterKey): void { - $kmipMasterKey['endpoint'] = 'doesnotexist.local:5698'; + $kmipMasterKey['endpoint'] = 'doesnotexist.invalid:5698'; $test->expectException(RuntimeException::class); - $test->expectExceptionMessageMatches('#doesnotexist.local#'); + $test->expectExceptionMessageMatches('#doesnotexist.invalid#'); $clientEncryption->createDataKey('kmip', ['masterKey' => $kmipMasterKey]); }, ];