@@ -66,17 +66,20 @@ functions:
66
66
# If this was a patch build, doing a fresh clone would not actually test the patch
67
67
cp -R ${PROJECT_DIRECTORY}/ $DRIVERS_TOOLS
68
68
else
69
- git clone git://github.com./mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
69
+ # git clone git://github.com./mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
70
+ git clone git://github.com./bazile-clyde/drivers-evergreen-tools.git $DRIVERS_TOOLS
70
71
fi
71
72
72
73
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" >
73
74
$MONGO_ORCHESTRATION_HOME/orchestration.config
74
75
bootstrap mongo-orchestration :
75
76
- command : shell.exec
76
77
params :
77
- script : |
78
+ script : >
78
79
${PREPARE_SHELL}
79
- MONGODB_VERSION=${VERSION} TOPOLOGY=${TOPOLOGY} bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
80
+
81
+ MONGODB_VERSION=${VERSION} TOPOLOGY=${TOPOLOGY} ORCHESTRATION_FILE=${ORCHESTRATION_FILE} bash
82
+ ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
80
83
- command : expansions.update
81
84
params :
82
85
file : mo-expansion.yml
@@ -154,6 +157,172 @@ functions:
154
157
NODE_LTS_NAME='${NODE_LTS_NAME}' ATLAS_REPL='${atlas_repl}' ATLAS_SHRD='${atlas_shrd}'
155
158
ATLAS_FREE='${atlas_free}' ATLAS_TLS11='${atlas_tls11}' ATLAS_TLS12='${atlas_tls12}' bash
156
159
${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh
160
+ add aws auth variables to file :
161
+ - command : shell.exec
162
+ type : test
163
+ params :
164
+ working_dir : src
165
+ silent : true
166
+ script : |
167
+ cat <<EOF > ${DRIVERS_TOOLS}/.evergreen/auth_aws/aws_e2e_setup.json
168
+ {
169
+ "iam_auth_ecs_account" : "${iam_auth_ecs_account}",
170
+ "iam_auth_ecs_secret_access_key" : "${iam_auth_ecs_secret_access_key}",
171
+ "iam_auth_ecs_account_arn": "arn:aws:iam::557821124784:user/authtest_fargate_user",
172
+ "iam_auth_ecs_cluster": "${iam_auth_ecs_cluster}",
173
+ "iam_auth_ecs_task_definition": "${iam_auth_ecs_task_definition}",
174
+ "iam_auth_ecs_subnet_a": "${iam_auth_ecs_subnet_a}",
175
+ "iam_auth_ecs_subnet_b": "${iam_auth_ecs_subnet_b}",
176
+ "iam_auth_ecs_security_group": "${iam_auth_ecs_security_group}",
177
+ "iam_auth_assume_aws_account" : "${iam_auth_assume_aws_account}",
178
+ "iam_auth_assume_aws_secret_access_key" : "${iam_auth_assume_aws_secret_access_key}",
179
+ "iam_auth_assume_role_name" : "${iam_auth_assume_role_name}",
180
+ "iam_auth_ec2_instance_account" : "${iam_auth_ec2_instance_account}",
181
+ "iam_auth_ec2_instance_secret_access_key" : "${iam_auth_ec2_instance_secret_access_key}",
182
+ "iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}"
183
+ }
184
+ EOF
185
+ run aws auth test with regular aws credentials :
186
+ - command : shell.exec
187
+ type : test
188
+ params :
189
+ working_dir : src
190
+ script : |
191
+ ${PREPARE_SHELL}
192
+ cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
193
+ ${MONGODB_BINARIES}/mongo aws_e2e_regular_aws.js
194
+ - command : shell.exec
195
+ type : test
196
+ params :
197
+ working_dir : src
198
+ silent : true
199
+ script : |
200
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
201
+ alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
202
+ USER=$(urlencode ${iam_auth_ecs_account})
203
+ PASS=$(urlencode ${iam_auth_ecs_secret_access_key})
204
+ export MONGODB_URI="mongodb://$USER:$PASS@localhost:27017/aws?authMechanism=MONGODB-AWS"
205
+ EOF
206
+ - command : shell.exec
207
+ type : test
208
+ params :
209
+ working_dir : src
210
+ script : |
211
+ ${PREPARE_SHELL}
212
+ ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
213
+ run aws auth test with assume role credentials :
214
+ - command : shell.exec
215
+ type : test
216
+ params :
217
+ working_dir : src
218
+ script : |
219
+ ${PREPARE_SHELL}
220
+ cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
221
+ ${MONGODB_BINARIES}/mongo aws_e2e_assume_role.js
222
+ - command : shell.exec
223
+ type : test
224
+ params :
225
+ working_dir : src
226
+ silent : true
227
+ script : |
228
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
229
+ alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
230
+ USER=$(jq -r '.AccessKeyId' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json)
231
+ USER=$(urlencode $USER)
232
+ PASS=$(jq -r '.SecretAccessKey' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json)
233
+ PASS=$(urlencode $PASS)
234
+ SESSION_TOKEN=$(jq -r '.SessionToken' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json)
235
+ SESSION_TOKEN=$(urlencode $SESSION_TOKEN)
236
+ export MONGODB_URI="mongodb://$USER:$PASS@localhost:27017/aws?authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:$SESSION_TOKEN"
237
+ EOF
238
+ - command : shell.exec
239
+ type : test
240
+ params :
241
+ working_dir : src
242
+ script : |
243
+ ${PREPARE_SHELL}
244
+ ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
245
+ run aws auth test with aws EC2 credentials :
246
+ - command : shell.exec
247
+ type : test
248
+ params :
249
+ working_dir : src
250
+ script : |
251
+ ${PREPARE_SHELL}
252
+ cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
253
+ ${MONGODB_BINARIES}/mongo aws_e2e_ec2.js
254
+ - command : shell.exec
255
+ type : test
256
+ params :
257
+ working_dir : src
258
+ script : |
259
+ ${PREPARE_SHELL}
260
+ ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
261
+ run aws auth test with aws credentials as environment variables :
262
+ - command : shell.exec
263
+ type : test
264
+ params :
265
+ working_dir : src
266
+ silent : true
267
+ script : |
268
+ cat <<EOF > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
269
+ export AWS_ACCESS_KEY_ID=${iam_auth_ecs_account}
270
+ export AWS_SECRET_ACCESS_KEY=${iam_auth_ecs_secret_access_key}
271
+ export MONGODB_URI="mongodb://localhost:27017/aws?authMechanism=MONGODB-AWS"
272
+ EOF
273
+ - command : shell.exec
274
+ type : test
275
+ params :
276
+ working_dir : src
277
+ script : |
278
+ ${PREPARE_SHELL}
279
+ ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
280
+ run aws auth test with aws credentials and session token as environment variables :
281
+ - command : shell.exec
282
+ type : test
283
+ params :
284
+ working_dir : src
285
+ silent : true
286
+ script : |
287
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
288
+ export AWS_ACCESS_KEY_ID=$(jq -r '.AccessKeyId' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json)
289
+ export AWS_SECRET_ACCESS_KEY=$(jq -r '.SecretAccessKey' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json)
290
+ export AWS_SESSION_TOKEN=$(jq -r '.SessionToken' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json)
291
+ export MONGODB_URI="mongodb://localhost:27017/aws?authMechanism=MONGODB-AWS"
292
+ EOF
293
+ - command : shell.exec
294
+ type : test
295
+ params :
296
+ working_dir : src
297
+ script : |
298
+ ${PREPARE_SHELL}
299
+ ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
300
+ run aws ECS auth test :
301
+ - command : shell.exec
302
+ type : test
303
+ params :
304
+ working_dir : src
305
+ script : |
306
+ ${PREPARE_SHELL}
307
+ AUTH_AWS_DIR=${DRIVERS_TOOLS}/.evergreen/auth_aws
308
+ ECS_SRC_DIR=$AUTH_AWS_DIR/src
309
+
310
+ # fix issue with `TestData` in SERVER-46340
311
+ sed -i '1s+^+TestData = {};\n+' $AUTH_AWS_DIR/lib/ecs_hosted_test.js
312
+
313
+ # pack up project directory to ssh it to the container
314
+ mkdir -p $ECS_SRC_DIR/.evergreen
315
+ cp $PROJECT_DIRECTORY/.evergreen/run-mongodb-aws-ecs-test.sh $ECS_SRC_DIR/.evergreen
316
+ tar -czf $ECS_SRC_DIR/src.tgz -C $PROJECT_DIRECTORY .
317
+
318
+ cd $AUTH_AWS_DIR
319
+ cat <<EOF > setup.js
320
+ const mongo_binaries = "$MONGODB_BINARIES";
321
+ const project_dir = "$ECS_SRC_DIR";
322
+ EOF
323
+
324
+ cat setup.js
325
+ mongo --nodb setup.js aws_e2e_ecs.js
157
326
pre :
158
327
- func : fetch source
159
328
- func : prepare resources
@@ -746,6 +915,21 @@ tasks:
746
915
- func : run atlas tests
747
916
vars :
748
917
VERSION : latest
918
+ - name : aws-auth-test
919
+ commands :
920
+ - func : install dependencies
921
+ - func : bootstrap mongo-orchestration
922
+ vars :
923
+ AUTH : auth
924
+ ORCHESTRATION_FILE : auth-aws.json
925
+ TOPOLOGY : server
926
+ - func : add aws auth variables to file
927
+ - func : run aws auth test with regular aws credentials
928
+ - func : run aws auth test with assume role credentials
929
+ - func : run aws auth test with aws EC2 credentials
930
+ - func : run aws auth test with aws credentials as environment variables
931
+ - func : run aws auth test with aws credentials and session token as environment variables
932
+ - func : run aws ECS auth test
749
933
buildvariants :
750
934
- name : debian71-test-boron
751
935
display_name : Debian 7.1 Node Boron
@@ -1191,3 +1375,10 @@ buildvariants:
1191
1375
expansions :
1192
1376
NODE_LTS_NAME : argon
1193
1377
tasks : *ref_5
1378
+ - name : ubuntu1804-test-mongodb-aws
1379
+ display_name : MONGODB-AWS Auth test
1380
+ run_on : ubuntu1804-test
1381
+ expansions :
1382
+ NODE_LTS_NAME : carbon
1383
+ tasks :
1384
+ - aws-auth-test
0 commit comments