Skip to content

Commit f4307c7

Browse files
ec2
1 parent 6f0da2f commit f4307c7

File tree

3 files changed

+26
-68
lines changed

3 files changed

+26
-68
lines changed

.evergreen/config.in.yml

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -536,30 +536,23 @@ functions:
536536
- .evergreen/run-mongodb-aws-test-copy.sh
537537

538538
"run aws auth test with aws EC2 credentials":
539-
- command: shell.exec
540-
type: test
539+
- command: ec2.assume_role
541540
params:
542-
working_dir: "src"
543-
shell: bash
544-
script: |
545-
${PREPARE_SHELL}
546-
# Write an empty prepare_mongodb_aws so no auth environment variables
547-
# are set.
548-
echo "" > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
549-
set -ex
550-
cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
551-
. ./activate-authawsvenv.sh
552-
python aws_tester.py ec2
553-
- command: shell.exec
541+
role_arn: ${OIDC_AWS_ROLE_ARN}
542+
- command: subprocess.exec
554543
type: test
555544
params:
545+
include_expansions_in_env:
546+
- MONGODB_URI
547+
- DRIVERS_TOOLS
548+
- MONGODB_AWS_SDK
556549
env:
557-
MONGODB_AWS_SDK: ${MONGODB_AWS_SDK}
558-
working_dir: "src"
559-
script: |
560-
${PREPARE_SHELL}
561-
export IS_EC2=true
562-
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
550+
AWS_CREDENTIAL_TYPE: ec2
551+
IS_EC2: 'true'
552+
working_dir: src
553+
binary: bash
554+
args:
555+
- .evergreen/run-mongodb-aws-test-copy.sh
563556

564557
"run aws auth test with aws credentials as environment variables":
565558
- command: ec2.assume_role
@@ -616,34 +609,6 @@ functions:
616609
args:
617610
- .evergreen/run-mongodb-aws-test-copy.sh
618611

619-
# - command: shell.exec
620-
# type: test
621-
# params:
622-
# working_dir: "src"
623-
# silent: true
624-
# shell: bash
625-
# script: |
626-
# set -ex
627-
# cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
628-
# . ./activate-authawsvenv.sh
629-
# python aws_tester.py web-identity
630-
# cd -
631-
# cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
632-
# export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file}
633-
# export AWS_ROLE_ARN=${iam_auth_assume_web_role_name}
634-
# export AWS_ROLE_SESSION_NAME='test'
635-
# export MONGODB_URI="mongodb://localhost:27017/aws?authMechanism=MONGODB-AWS"
636-
# EOF
637-
# - command: shell.exec
638-
# type: test
639-
# params:
640-
# env:
641-
# MONGODB_AWS_SDK: ${MONGODB_AWS_SDK}
642-
# working_dir: "src"
643-
# script: |
644-
# ${PREPARE_SHELL}
645-
# ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
646-
647612
"run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME unset":
648613
- command: ec2.assume_role
649614
params:

.evergreen/config.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -477,30 +477,23 @@ functions:
477477
args:
478478
- .evergreen/run-mongodb-aws-test-copy.sh
479479
run aws auth test with aws EC2 credentials:
480-
- command: shell.exec
481-
type: test
480+
- command: ec2.assume_role
482481
params:
483-
working_dir: src
484-
shell: bash
485-
script: |
486-
${PREPARE_SHELL}
487-
# Write an empty prepare_mongodb_aws so no auth environment variables
488-
# are set.
489-
echo "" > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
490-
set -ex
491-
cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
492-
. ./activate-authawsvenv.sh
493-
python aws_tester.py ec2
494-
- command: shell.exec
482+
role_arn: ${OIDC_AWS_ROLE_ARN}
483+
- command: subprocess.exec
495484
type: test
496485
params:
486+
include_expansions_in_env:
487+
- MONGODB_URI
488+
- DRIVERS_TOOLS
489+
- MONGODB_AWS_SDK
497490
env:
498-
MONGODB_AWS_SDK: ${MONGODB_AWS_SDK}
491+
AWS_CREDENTIAL_TYPE: ec2
492+
IS_EC2: 'true'
499493
working_dir: src
500-
script: |
501-
${PREPARE_SHELL}
502-
export IS_EC2=true
503-
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
494+
binary: bash
495+
args:
496+
- .evergreen/run-mongodb-aws-test-copy.sh
504497
run aws auth test with aws credentials as environment variables:
505498
- command: ec2.assume_role
506499
params:

.evergreen/generate_evergreen_tasks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ for (const VERSION of AWS_AUTH_VERSIONS) {
339339
const awsFuncs = [
340340
{ func: 'run aws auth test with regular aws credentials' }, // done
341341
{ func: 'run aws auth test with assume role credentials' }, // done
342-
{ func: 'run aws auth test with aws EC2 credentials', onlySdk: true },
342+
{ func: 'run aws auth test with aws EC2 credentials', onlySdk: true }, // done
343343
{ func: 'run aws auth test with aws credentials as environment variables' }, // done
344344
{ func: 'run aws auth test with aws credentials and session token as environment variables' }, // done
345345
{ func: 'run aws ECS auth test' },

0 commit comments

Comments
 (0)