Skip to content

Commit 5ea2fb3

Browse files
committed
feat(NODE-5464): OIDC machine workflow
1 parent e0a37e5 commit 5ea2fb3

Some content is hidden

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

42 files changed

+848
-1699
lines changed

.evergreen/config.in.yml

+64-7
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,29 @@ functions:
171171
${PREPARE_SHELL}
172172
173173
OIDC_TOKEN_DIR="/tmp/tokens" \
174+
PROVIDER_NAME="aws" \
174175
AWS_WEB_IDENTITY_TOKEN_FILE="/tmp/tokens/test_user1" \
176+
OIDC_ATLAS_URI_SINGLE="${OIDC_ATLAS_URI_SINGLE}" \
177+
OIDC_ATLAS_URI_MULTI="${OIDC_ATLAS_URI_MULTI}" \
175178
PROJECT_DIRECTORY="${PROJECT_DIRECTORY}" \
176179
bash ${PROJECT_DIRECTORY}/.evergreen/run-oidc-tests.sh
177180
181+
"run oidc auth tests aws":
182+
- command: shell.exec
183+
type: test
184+
params:
185+
working_dir: "src"
186+
timeout_secs: 300
187+
shell: bash
188+
script: |
189+
${PREPARE_SHELL}
190+
191+
OIDC_TOKEN_DIR="/tmp/tokens" \
192+
PROVIDER_NAME="aws" \
193+
AWS_WEB_IDENTITY_TOKEN_FILE="/tmp/tokens/test_user1" \
194+
PROJECT_DIRECTORY="${PROJECT_DIRECTORY}" \
195+
bash ${PROJECT_DIRECTORY}/.evergreen/run-oidc-auth-tests.sh
196+
178197
"run tests":
179198
- command: shell.exec
180199
type: test
@@ -1271,8 +1290,28 @@ tasks:
12711290
env:
12721291
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
12731292
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
1274-
AZUREOIDC_CLIENTID: ${testazureoidc_clientid}
12751293
PROVIDER_NAME: azure
1294+
SCRIPT: run-oidc-tests.sh
1295+
args:
1296+
- .evergreen/run-oidc-tests-azure.sh
1297+
1298+
- name: "oidc-auth-test-azure-latest-auth"
1299+
commands:
1300+
- command: expansions.update
1301+
type: setup
1302+
params:
1303+
updates:
1304+
- { key: NPM_VERSION, value: "9" }
1305+
- func: "install dependencies"
1306+
- command: subprocess.exec
1307+
params:
1308+
working_dir: src
1309+
binary: bash
1310+
env:
1311+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
1312+
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
1313+
PROVIDER_NAME: azure
1314+
SCRIPT: run-oidc-auth-tests.sh
12761315
args:
12771316
- .evergreen/run-oidc-tests-azure.sh
12781317

@@ -1427,14 +1466,9 @@ task_groups:
14271466
script: |-
14281467
set -o errexit
14291468
${PREPARE_SHELL}
1430-
export AZUREOIDC_CLIENTID="${testazureoidc_clientid}"
1431-
export AZUREOIDC_TENANTID="${testazureoic_tenantid}"
1432-
export AZUREOIDC_SECRET="${testazureoidc_secret}"
1433-
export AZUREOIDC_KEYVAULT=${testazureoidc_keyvault}
1434-
export AZUREOIDC_DRIVERS_TOOLS="$DRIVERS_TOOLS"
14351469
export AZUREOIDC_VMNAME_PREFIX="NODE_DRIVER"
14361470
$DRIVERS_TOOLS/.evergreen/auth_oidc/azure/create-and-setup-vm.sh
1437-
teardown_group:
1471+
teardown_task:
14381472
- command: shell.exec
14391473
params:
14401474
shell: bash
@@ -1446,6 +1480,29 @@ task_groups:
14461480
tasks:
14471481
- oidc-auth-test-azure-latest
14481482

1483+
- name: testazureoidcauth_task_group
1484+
setup_group:
1485+
- func: fetch source
1486+
- command: shell.exec
1487+
params:
1488+
shell: bash
1489+
script: |-
1490+
set -o errexit
1491+
${PREPARE_SHELL}
1492+
export AZUREOIDC_VMNAME_PREFIX="NODE_DRIVER"
1493+
$DRIVERS_TOOLS/.evergreen/auth_oidc/azure/create-and-setup-vm.sh
1494+
teardown_task:
1495+
- command: shell.exec
1496+
params:
1497+
shell: bash
1498+
script: |-
1499+
${PREPARE_SHELL}
1500+
$DRIVERS_TOOLS/.evergreen/auth_oidc/azure/delete-vm.sh
1501+
setup_group_can_fail_task: true
1502+
setup_group_timeout_secs: 1800
1503+
tasks:
1504+
- oidc-auth-test-azure-latest-auth
1505+
14491506
- name: test_atlas_task_group
14501507
setup_group:
14511508
- func: fetch source

.evergreen/config.yml

+96-7
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,27 @@ functions:
142142
${PREPARE_SHELL}
143143
144144
OIDC_TOKEN_DIR="/tmp/tokens" \
145+
PROVIDER_NAME="aws" \
145146
AWS_WEB_IDENTITY_TOKEN_FILE="/tmp/tokens/test_user1" \
147+
OIDC_ATLAS_URI_SINGLE="${OIDC_ATLAS_URI_SINGLE}" \
148+
OIDC_ATLAS_URI_MULTI="${OIDC_ATLAS_URI_MULTI}" \
146149
PROJECT_DIRECTORY="${PROJECT_DIRECTORY}" \
147150
bash ${PROJECT_DIRECTORY}/.evergreen/run-oidc-tests.sh
151+
run oidc auth tests aws:
152+
- command: shell.exec
153+
type: test
154+
params:
155+
working_dir: src
156+
timeout_secs: 300
157+
shell: bash
158+
script: |
159+
${PREPARE_SHELL}
160+
161+
OIDC_TOKEN_DIR="/tmp/tokens" \
162+
PROVIDER_NAME="aws" \
163+
AWS_WEB_IDENTITY_TOKEN_FILE="/tmp/tokens/test_user1" \
164+
PROJECT_DIRECTORY="${PROJECT_DIRECTORY}" \
165+
bash ${PROJECT_DIRECTORY}/.evergreen/run-oidc-auth-tests.sh
148166
run tests:
149167
- command: shell.exec
150168
type: test
@@ -1222,8 +1240,27 @@ tasks:
12221240
env:
12231241
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
12241242
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
1225-
AZUREOIDC_CLIENTID: ${testazureoidc_clientid}
12261243
PROVIDER_NAME: azure
1244+
SCRIPT: run-oidc-tests.sh
1245+
args:
1246+
- .evergreen/run-oidc-tests-azure.sh
1247+
- name: oidc-auth-test-azure-latest-auth
1248+
commands:
1249+
- command: expansions.update
1250+
type: setup
1251+
params:
1252+
updates:
1253+
- {key: NPM_VERSION, value: '9'}
1254+
- func: install dependencies
1255+
- command: subprocess.exec
1256+
params:
1257+
working_dir: src
1258+
binary: bash
1259+
env:
1260+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
1261+
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
1262+
PROVIDER_NAME: azure
1263+
SCRIPT: run-oidc-auth-tests.sh
12271264
args:
12281265
- .evergreen/run-oidc-tests-azure.sh
12291266
- name: test-aws-lambda-deployed
@@ -1837,6 +1874,25 @@ tasks:
18371874
- func: bootstrap mongo-orchestration
18381875
- func: setup oidc roles
18391876
- func: run oidc tests aws
1877+
- name: test-auth-oidc-aws
1878+
tags:
1879+
- latest
1880+
- replica_set
1881+
- oidc
1882+
commands:
1883+
- command: expansions.update
1884+
type: setup
1885+
params:
1886+
updates:
1887+
- {key: VERSION, value: latest}
1888+
- {key: TOPOLOGY, value: replica_set}
1889+
- {key: AUTH, value: auth}
1890+
- {key: ORCHESTRATION_FILE, value: auth-oidc.json}
1891+
- func: install dependencies
1892+
- func: bootstrap oidc
1893+
- func: bootstrap mongo-orchestration
1894+
- func: setup oidc roles
1895+
- func: run oidc auth tests aws
18401896
- name: test-socks5
18411897
tags: []
18421898
commands:
@@ -3814,14 +3870,9 @@ task_groups:
38143870
script: |-
38153871
set -o errexit
38163872
${PREPARE_SHELL}
3817-
export AZUREOIDC_CLIENTID="${testazureoidc_clientid}"
3818-
export AZUREOIDC_TENANTID="${testazureoic_tenantid}"
3819-
export AZUREOIDC_SECRET="${testazureoidc_secret}"
3820-
export AZUREOIDC_KEYVAULT=${testazureoidc_keyvault}
3821-
export AZUREOIDC_DRIVERS_TOOLS="$DRIVERS_TOOLS"
38223873
export AZUREOIDC_VMNAME_PREFIX="NODE_DRIVER"
38233874
$DRIVERS_TOOLS/.evergreen/auth_oidc/azure/create-and-setup-vm.sh
3824-
teardown_group:
3875+
teardown_task:
38253876
- command: shell.exec
38263877
params:
38273878
shell: bash
@@ -3832,6 +3883,28 @@ task_groups:
38323883
setup_group_timeout_secs: 1800
38333884
tasks:
38343885
- oidc-auth-test-azure-latest
3886+
- name: testazureoidcauth_task_group
3887+
setup_group:
3888+
- func: fetch source
3889+
- command: shell.exec
3890+
params:
3891+
shell: bash
3892+
script: |-
3893+
set -o errexit
3894+
${PREPARE_SHELL}
3895+
export AZUREOIDC_VMNAME_PREFIX="NODE_DRIVER"
3896+
$DRIVERS_TOOLS/.evergreen/auth_oidc/azure/create-and-setup-vm.sh
3897+
teardown_task:
3898+
- command: shell.exec
3899+
params:
3900+
shell: bash
3901+
script: |-
3902+
${PREPARE_SHELL}
3903+
$DRIVERS_TOOLS/.evergreen/auth_oidc/azure/delete-vm.sh
3904+
setup_group_can_fail_task: true
3905+
setup_group_timeout_secs: 1800
3906+
tasks:
3907+
- oidc-auth-test-azure-latest-auth
38353908
- name: test_atlas_task_group
38363909
setup_group:
38373910
- func: fetch source
@@ -3947,6 +4020,7 @@ buildvariants:
39474020
- test-auth-kerberos
39484021
- test-auth-ldap
39494022
- test-auth-oidc
4023+
- test-auth-oidc-aws
39504024
- test-socks5
39514025
- test-socks5-csfle
39524026
- test-socks5-tls
@@ -3998,6 +4072,7 @@ buildvariants:
39984072
- test-auth-kerberos
39994073
- test-auth-ldap
40004074
- test-auth-oidc
4075+
- test-auth-oidc-aws
40014076
- test-socks5
40024077
- test-socks5-csfle
40034078
- test-socks5-tls
@@ -4049,6 +4124,7 @@ buildvariants:
40494124
- test-auth-kerberos
40504125
- test-auth-ldap
40514126
- test-auth-oidc
4127+
- test-auth-oidc-aws
40524128
- test-socks5
40534129
- test-socks5-csfle
40544130
- test-socks5-tls
@@ -4099,6 +4175,7 @@ buildvariants:
40994175
- test-auth-kerberos
41004176
- test-auth-ldap
41014177
- test-auth-oidc
4178+
- test-auth-oidc-aws
41024179
- test-socks5
41034180
- test-socks5-csfle
41044181
- test-socks5-tls
@@ -4386,6 +4463,18 @@ buildvariants:
43864463
tasks:
43874464
- test_azurekms_task_group
43884465
- test-azurekms-fail-task
4466+
- name: ubuntu20-test-azure-oidc
4467+
display_name: Azure OIDC
4468+
run_on: ubuntu2004-small
4469+
batchtime: 20160
4470+
tasks:
4471+
- testazureoidc_task_group
4472+
- name: ubuntu20-test-azure-oidc-auth
4473+
display_name: Azure OIDC Auth Tests
4474+
run_on: ubuntu2004-small
4475+
batchtime: 20160
4476+
tasks:
4477+
- testazureoidcauth_task_group
43894478
- name: rhel8-test-atlas
43904479
display_name: Atlas Cluster Tests
43914480
run_on: rhel80-large

.evergreen/generate_evergreen_tasks.js

+32-10
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,23 @@ TASKS.push(
199199
{ func: 'run oidc tests aws' }
200200
]
201201
},
202+
{
203+
name: 'test-auth-oidc-aws',
204+
tags: ['latest', 'replica_set', 'oidc'],
205+
commands: [
206+
updateExpansions({
207+
VERSION: 'latest',
208+
TOPOLOGY: 'replica_set',
209+
AUTH: 'auth',
210+
ORCHESTRATION_FILE: 'auth-oidc.json'
211+
}),
212+
{ func: 'install dependencies' },
213+
{ func: 'bootstrap oidc' },
214+
{ func: 'bootstrap mongo-orchestration' },
215+
{ func: 'setup oidc roles' },
216+
{ func: 'run oidc auth tests aws' }
217+
]
218+
},
202219
{
203220
name: 'test-socks5',
204221
tags: [],
@@ -710,16 +727,21 @@ BUILD_VARIANTS.push({
710727
tasks: ['test_azurekms_task_group', 'test-azurekms-fail-task']
711728
});
712729

713-
// TODO(DRIVERS-2416/NODE-4929) - Azure credentials are expired, a new drivers ticket
714-
// should be created but at the moment for our test failures we will reference the
715-
// open DRIVERS ticket and completed NODE ticket.
716-
// BUILD_VARIANTS.push({
717-
// name: 'ubuntu20-test-azure-oidc',
718-
// display_name: 'Azure OIDC',
719-
// run_on: UBUNTU_20_OS,
720-
// batchtime: 20160,
721-
// tasks: ['testazureoidc_task_group']
722-
// });
730+
BUILD_VARIANTS.push({
731+
name: 'ubuntu20-test-azure-oidc',
732+
display_name: 'Azure OIDC',
733+
run_on: UBUNTU_20_OS,
734+
batchtime: 20160,
735+
tasks: ['testazureoidc_task_group']
736+
});
737+
738+
BUILD_VARIANTS.push({
739+
name: 'ubuntu20-test-azure-oidc-auth',
740+
display_name: 'Azure OIDC Auth Tests',
741+
run_on: UBUNTU_20_OS,
742+
batchtime: 20160,
743+
tasks: ['testazureoidcauth_task_group']
744+
});
723745

724746
BUILD_VARIANTS.push({
725747
name: 'rhel8-test-atlas',

.evergreen/run-oidc-auth-tests.sh

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
set -o errexit # Exit the script with error if any of the commands fail
3+
set -o xtrace # Write all commands first to stderr
4+
5+
PROVIDER_NAME=${PROVIDER_NAME:-"aws"}
6+
PROJECT_DIRECTORY=${PROJECT_DIRECTORY:-"."}
7+
source "${PROJECT_DIRECTORY}/.evergreen/init-node-and-npm-env.sh"
8+
9+
MONGODB_URI=${MONGODB_URI:-"mongodb://127.0.0.1:27017"}
10+
11+
export OIDC_TOKEN_DIR=${OIDC_TOKEN_DIR}
12+
13+
export MONGODB_URI=${MONGODB_URI:-"mongodb://localhost"}
14+
15+
if [ "$PROVIDER_NAME" = "azure" ]; then
16+
if [ -z "${AZUREOIDC_CLIENTID}" ]; then
17+
echo "Must specify an AZUREOIDC_CLIENTID"
18+
exit 1
19+
fi
20+
21+
export UTIL_CLIENT_USER=$AZUREOIDC_USERNAME
22+
export UTIL_CLIENT_PASSWORD="pwd123"
23+
MONGODB_URI="${MONGODB_URI}/?authMechanism=MONGODB-OIDC"
24+
MONGODB_URI="${MONGODB_URI}&authMechanismProperties=PROVIDER_NAME:azure"
25+
MONGODB_URI="${MONGODB_URI},TOKEN_AUDIENCE:api%3A%2F%2F${AZUREOIDC_CLIENTID}"
26+
export MONGODB_URI="${MONGODB_URI},TOKEN_CLIENT_ID:${AZUREOIDC_TOKENCLIENT}"
27+
else
28+
if [ -z "${OIDC_TOKEN_DIR}" ]; then
29+
echo "Must specify OIDC_TOKEN_DIR"
30+
exit 1
31+
fi
32+
33+
export UTIL_CLIENT_USER="bob"
34+
export UTIL_CLIENT_PASSWORD="pwd123"
35+
export MONGODB_URI="${MONGODB_URI}/test?authMechanism=MONGODB-OIDC&authMechanismProperties=PROVIDER_NAME:aws"
36+
fi
37+
38+
npm run check:oidc-auth

.evergreen/run-oidc-tests-azure.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ set -o errexit # Exit the script with error if any of the commands fail
44

55
export AZUREOIDC_DRIVERS_TAR_FILE=/tmp/node-mongodb-native.tgz
66
tar czf $AZUREOIDC_DRIVERS_TAR_FILE .
7-
export AZUREOIDC_TEST_CMD="source ./env.sh && PROVIDER_NAME=azure ./.evergreen/run-oidc-tests.sh"
8-
export AZUREOIDC_CLIENTID=$AZUREOIDC_CLIENTID
7+
export AZUREOIDC_TEST_CMD="source ./env.sh && PROVIDER_NAME=azure ./.evergreen/${SCRIPT}"
98
export PROJECT_DIRECTORY=$PROJECT_DIRECTORY
109
export PROVIDER_NAME=$PROVIDER_NAME
1110
bash $DRIVERS_TOOLS/.evergreen/auth_oidc/azure/run-driver-test.sh

0 commit comments

Comments
 (0)