File tree 3 files changed +24
-5
lines changed
3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,20 @@ functions:
67
67
bucket : evg-bucket-evergreen-ui
68
68
content_type : text/plain
69
69
permissions : public-read
70
+
71
+ attach-restore-logs :
72
+ command : s3.put
73
+ type : system
74
+ params :
75
+ aws_key : ${AWS_ACCESS_KEY_ID}
76
+ aws_secret : ${AWS_SECRET_ACCESS_KEY}
77
+ aws_session_token : ${AWS_SESSION_TOKEN}
78
+ local_file : " ui/${app_dir}/restore-logs.txt"
79
+ remote_file : ${build_variant}/${task_id}/${execution}/restore-logs.txt
80
+ bucket : evg-bucket-evergreen-ui
81
+ content_type : text/plain
82
+ permissions : public-read
83
+ display_name : restore-logs
70
84
71
85
attach-source-map :
72
86
command : s3.put
Original file line number Diff line number Diff line change 28
28
- func : attach-cypress-results
29
29
- func : attach-email
30
30
- func : attach-logkeeper-logs
31
+ - func : attach-restore-logs
31
32
- func : attach-source-map
32
33
- func : attach-storybook
33
34
- func : attach-test-results
Original file line number Diff line number Diff line change @@ -77,16 +77,20 @@ restore_db() {
77
77
echo " Error: $1 does not exist. Ensure you have a valid dump before restoring."
78
78
exit 1
79
79
fi
80
-
80
+ if [ " $CI " = ' true' ]; then
81
+ LOG_FILE=" restore-logs.txt"
82
+ else
83
+ LOG_FILE=" /dev/stdout"
84
+ fi
81
85
# Use 'mongorestore' to restore the database from the dump.
82
86
for (( retry= 0 ; retry<= MAX_RETRIES; retry++ )) ; do
83
- if mongorestore --quiet --drop --uri=" $2 " " $1 " ; then
84
- echo " Successfully restored the database from $1 ."
87
+ if mongorestore --stopOnError --drop --uri=" $2 " " $1 " >> " $LOG_FILE " 2>&1 ; then
88
+ echo " Successfully restored the database from $1 ." >> " $LOG_FILE "
85
89
break
86
90
else
87
- echo " Error restoring the database from $1 . Retry attempt: $retry "
91
+ echo " Error restoring the database from $1 . Retry attempt: $retry " >> " $LOG_FILE "
88
92
if [ $retry -eq $MAX_RETRIES ]; then
89
- echo " Max retries reached. Exiting."
93
+ echo " Max retries reached. Exiting." >> " $LOG_FILE "
90
94
exit 1
91
95
fi
92
96
sleep 3
You can’t perform that action at this time.
0 commit comments