File tree Expand file tree Collapse file tree 3 files changed +74
-0
lines changed
config_generator/components/funcs Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 42
42
- func : upload-test-results
43
43
- func : stop-mongo-orchestration
44
44
- func : stop-load-balancer
45
+ - func : restore-instance-profile
45
46
46
47
include :
47
48
- filename : .evergreen/generated_configs/legacy-config.yml
Original file line number Diff line number Diff line change
1
+ from config_generator .etc .function import Function
2
+ from config_generator .etc .utils import bash_exec
3
+
4
+
5
+ class RestoreInstanceProfile (Function ):
6
+ name = 'restore-instance-profile'
7
+ commands = [
8
+ bash_exec (
9
+ script = '''\
10
+ # Restore the AWS Instance Profile that may have been removed in AWS tasks.
11
+
12
+ if [[ ! -d drivers-evergreen-tools ]]; then
13
+ echo "drivers-evergreen-tools not present ... skipping"
14
+ exit 0
15
+ fi
16
+
17
+ cd drivers-evergreen-tools/.evergreen/auth_aws
18
+ if [[ ! -f aws_e2e_setup.json ]]; then
19
+ echo "aws_e2e_setup.json not present ... skipping"
20
+ exit 0
21
+ fi
22
+
23
+ . ./activate-authawsvenv.sh
24
+
25
+ echo "restoring instance profile ... "
26
+ # Capture and hide logs on success. Logs may included expected `HTTP Error 404: Not Found` messages when checking for instance profile.
27
+ if ! { python ./lib/aws_assign_instance_profile.py 2>&1 >|output.txt; }; then
28
+ echo "restoring instance profile ... failed"
29
+ cat output.txt 1>&2
30
+ exit 1
31
+ fi
32
+ echo "restoring instance profile ... succeeded"
33
+ '''
34
+ ),
35
+ ]
36
+
37
+ @classmethod
38
+ def call (cls , ** kwargs ):
39
+ return cls .default_call (** kwargs )
40
+
41
+
42
+ def functions ():
43
+ return RestoreInstanceProfile .defn ()
Original file line number Diff line number Diff line change @@ -288,6 +288,36 @@ functions:
288
288
set -o errexit
289
289
bash tools/poetry.sh install --with=docs
290
290
bash tools/poetry.sh run bash .evergreen/scripts/check-release-archive.sh
291
+ restore-instance-profile :
292
+ - command : subprocess.exec
293
+ params :
294
+ binary : bash
295
+ args :
296
+ - -c
297
+ - |
298
+ # Restore the AWS Instance Profile that may have been removed in AWS tasks.
299
+
300
+ if [[ ! -d drivers-evergreen-tools ]]; then
301
+ echo "drivers-evergreen-tools not present ... skipping"
302
+ exit 0
303
+ fi
304
+
305
+ cd drivers-evergreen-tools/.evergreen/auth_aws
306
+ if [[ ! -f aws_e2e_setup.json ]]; then
307
+ echo "aws_e2e_setup.json not present ... skipping"
308
+ exit 0
309
+ fi
310
+
311
+ . ./activate-authawsvenv.sh
312
+
313
+ echo "restoring instance profile ... "
314
+ # Capture and hide logs on success. Logs may included expected `HTTP Error 404: Not Found` messages when checking for instance profile.
315
+ if ! { python ./lib/aws_assign_instance_profile.py 2>&1 >|output.txt; }; then
316
+ echo "restoring instance profile ... failed"
317
+ cat output.txt 1>&2
318
+ exit 1
319
+ fi
320
+ echo "restoring instance profile ... succeeded"
291
321
run-mock-kms-servers :
292
322
- command : subprocess.exec
293
323
type : setup
You can’t perform that action at this time.
0 commit comments