Skip to content

Commit 91beff0

Browse files
authored
chore(ci): wrap bash scripts in curly brackets (#554)
Evergreen implements bash script execution by piping into bash. This is not good, because it means that commands might actually end up in a subprocess’s stdin instead of bash itself, leading to commands being skipped. Use curly brackets to make sure that bash has read the entire script before it starts executing it. (See https://jira.mongodb.org/browse/EVG-13667)
1 parent 8152f82 commit 91beff0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.evergreen.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ variables:
1212
shell: bash
1313
script: |
1414
set -e
15+
{ # curly brackets to work around EVG-13667
1516
cd $(pwd)
1617
export NODE_JS_VERSION=${node_js_version}
1718
source .evergreen/.setup_env
@@ -39,6 +40,7 @@ variables:
3940
echo "$MONGOSH_TEST_EXECUTABLE_PATH"
4041
npm run test-e2e-ci
4142
tar cvzf dist.tgz dist
43+
}
4244
4345
- &package_and_upload_artifact
4446
command: shell.exec
@@ -47,6 +49,7 @@ variables:
4749
shell: bash
4850
script: |
4951
set -e
52+
{
5053
cat <<RELEASE_MONGOSH > ~/release_mongosh.sh
5154
set -e
5255
cd $(pwd)
@@ -79,6 +82,7 @@ variables:
7982
else
8083
bash ~/release_mongosh.sh
8184
fi
85+
}
8286
8387
- &test_linux_artifact
8488
command: shell.exec
@@ -87,13 +91,15 @@ variables:
8791
shell: bash
8892
script: |
8993
set -e
94+
{
9095
export NODE_JS_VERSION=${node_js_version}
9196
source .evergreen/.setup_env
9297
node scripts/download-linux-artifact
9398
dist/mongosh --version
9499
export MONGOSH_TEST_EXECUTABLE_PATH="$(pwd)/dist/mongosh"
95100
echo "$MONGOSH_TEST_EXECUTABLE_PATH"
96101
npm run test-e2e-ci
102+
}
97103
98104
# Functions are any command that can be run.
99105
#
@@ -129,9 +135,12 @@ functions:
129135
working_dir: src
130136
shell: bash
131137
script: |
138+
set -e
139+
{
132140
export NODE_JS_VERSION=${node_js_version}
133141
source .evergreen/.setup_env
134142
npm run check-ci
143+
}
135144
test:
136145
- command: expansions.write
137146
params:
@@ -166,10 +175,12 @@ functions:
166175
shell: bash
167176
script: |
168177
set -e
178+
{
169179
(cd scripts/docker && docker build -t ubuntu18.04-xvfb -f ubuntu18.04-xvfb.Dockerfile .)
170180
docker run \
171181
--rm -v $PWD:/tmp/build ubuntu18.04-xvfb \
172182
-c 'cd /tmp/build && ./testing/test-vscode.sh'
183+
}
173184
test_connectivity:
174185
- command: expansions.write
175186
params:
@@ -181,9 +192,11 @@ functions:
181192
shell: bash
182193
script: |
183194
set -e
195+
{
184196
export NODE_JS_VERSION=${node_js_version}
185197
source .evergreen/.setup_env
186198
npm run test-connectivity
199+
}
187200
compile_artifact:
188201
- command: expansions.write
189202
params:
@@ -229,11 +242,13 @@ functions:
229242
shell: bash
230243
script: |
231244
set -e
245+
{
232246
export NODE_JS_VERSION=${node_js_version}
233247
source .evergreen/.setup_env
234248
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
235249
echo "//registry.npmjs.org/:_authToken=${DEVTOOLSBOT_NPM_TOKEN}" > .npmrc
236250
npm run evergreen-release publish
251+
}
237252
238253
# Tasks will show up as the individual blocks in the Evergreen UI that can
239254
# pass or fail.

0 commit comments

Comments
 (0)