Skip to content

Commit 29f5998

Browse files
authored
fix(ci): rearrange evergreen prepare function to install Node.js earlier COMPASS-9669 COMPASS-9683 COMPASS-9687 (#7193)
* Rename "macos13" to "macos-11" to match build variant names * Refactor preinstall.sh into an earlier install-node.sh * Use .deps/bin/node explicitly
1 parent e9e14a4 commit 29f5998

8 files changed

+79
-74
lines changed

.evergreen/buildvariants-and-tasks.in.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ buildvariants:
245245
tasks:
246246
<% for (const group of E2E_TEST_GROUPS) { %>
247247
<% if (['test-packaged-app-macos-11-arm', 'test-packaged-app-macos-11-x64'].includes(buildVariant.name)) { %>
248-
- name: test-packaged-app-macos13-<%= group.number %>
248+
- name: test-packaged-app-macos-11-<%= group.number %>
249249
<% } else { %>
250250
- name: test-packaged-app-<%= group.number %>
251251
<% } %>
@@ -508,7 +508,7 @@ tasks:
508508
e2e_test_group: <%= group.number %>
509509
debug: 'compass-e2e-tests*,electron*,hadron*,mongo*'
510510

511-
- name: test-packaged-app-macos13-<%= group.number %>
511+
- name: test-packaged-app-macos-11-<%= group.number %>
512512
tags:
513513
- required-for-publish
514514
- run-on-pr

.evergreen/buildvariants-and-tasks.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ buildvariants:
210210
- name: package-compass
211211
variant: package-macos-arm
212212
tasks:
213-
- name: test-packaged-app-macos13-1
214-
- name: test-packaged-app-macos13-2
215-
- name: test-packaged-app-macos13-3
213+
- name: test-packaged-app-macos-11-1
214+
- name: test-packaged-app-macos-11-2
215+
- name: test-packaged-app-macos-11-3
216216
- name: test-packaged-app-macos-11-x64
217217
display_name: Test Packaged App MacOS x64 11
218218
run_on: macos-11-gui
@@ -221,9 +221,9 @@ buildvariants:
221221
- name: package-compass
222222
variant: package-macos-x64
223223
tasks:
224-
- name: test-packaged-app-macos13-1
225-
- name: test-packaged-app-macos13-2
226-
- name: test-packaged-app-macos13-3
224+
- name: test-packaged-app-macos-11-1
225+
- name: test-packaged-app-macos-11-2
226+
- name: test-packaged-app-macos-11-3
227227
- name: test-packaged-app-macos-14-arm
228228
display_name: Test Packaged App MacOS arm64 14
229229
run_on: macos-14-arm64-gui
@@ -1294,7 +1294,7 @@ tasks:
12941294
e2e_test_groups: 3
12951295
e2e_test_group: 1
12961296
debug: compass-e2e-tests*,electron*,hadron*,mongo*
1297-
- name: test-packaged-app-macos13-1
1297+
- name: test-packaged-app-macos-11-1
12981298
tags:
12991299
- required-for-publish
13001300
- run-on-pr
@@ -1344,7 +1344,7 @@ tasks:
13441344
e2e_test_groups: 3
13451345
e2e_test_group: 2
13461346
debug: compass-e2e-tests*,electron*,hadron*,mongo*
1347-
- name: test-packaged-app-macos13-2
1347+
- name: test-packaged-app-macos-11-2
13481348
tags:
13491349
- required-for-publish
13501350
- run-on-pr
@@ -1394,7 +1394,7 @@ tasks:
13941394
e2e_test_groups: 3
13951395
e2e_test_group: 3
13961396
debug: compass-e2e-tests*,electron*,hadron*,mongo*
1397-
- name: test-packaged-app-macos13-3
1397+
- name: test-packaged-app-macos-11-3
13981398
tags:
13991399
- required-for-publish
14001400
- run-on-pr

.evergreen/functions.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,23 +149,11 @@ functions:
149149
<<: *compass-env
150150
script: |
151151
set -e
152-
eval $(.evergreen/print-compass-env.sh)
153-
154-
# Make all the dirs
155-
mkdir -p $ARTIFACTS_PATH
152+
.evergreen/install-node.sh
156153
157-
- command: shell.exec
158-
type: setup
159-
params:
160-
working_dir: src
161-
shell: bash
162-
env:
163-
<<: *compass-env
164-
script: |
165-
set -e
166154
eval $(.evergreen/print-compass-env.sh)
167155
168-
.evergreen/preinstall.sh
156+
.evergreen/print-debug-info.sh
169157
170158
# Make sure install worked
171159
echo "Using node version:";

.evergreen/preinstall.sh renamed to .evergreen/install-node.sh

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,12 @@
22

33
set -e
44

5-
echo "========================="
6-
echo "Important Environment Variables"
7-
echo "========================="
8-
echo "PLATFORM: $PLATFORM"
9-
echo "ARCH: $ARCH"
10-
echo "NODE_JS_VERSION: $NODE_JS_VERSION"
11-
echo "NPM_VERSION: $NPM_VERSION"
12-
echo "APPDATA: $APPDATA"
13-
echo "PATH: $PATH"
14-
15-
# these are super useful if you want to run the smoke tests locally
16-
echo "export DEV_VERSION_IDENTIFIER=$DEV_VERSION_IDENTIFIER"
17-
echo "export EVERGREEN_BUCKET_KEY_PREFIX=$EVERGREEN_BUCKET_KEY_PREFIX"
18-
echo "export EVERGREEN_BUCKET_NAME=$EVERGREEN_BUCKET_NAME"
19-
20-
echo "IS_OSX: $IS_OSX"
21-
echo "IS_LINUX: $IS_LINUX"
22-
echo "IS_WINDOWS: $IS_WINDOWS"
23-
echo "IS_RHEL: $IS_RHEL"
24-
echo "IS_UBUNTU: $IS_UBUNTU"
5+
SCRIPTDIR="$(cd $(dirname "$0"); pwd)"
256

26-
echo "DOCKER_CONFIG: $DOCKER_CONFIG"
7+
source $SCRIPTDIR/set-platform-env.sh
278

28-
SCRIPTDIR="$(cd $(dirname "$0"); pwd)"
9+
# Ensure the .deps directory exists
10+
mkdir -p .deps
2911

3012
if [ -n "$IS_WINDOWS" ]; then
3113
echo "Installing nodejs v$NODE_JS_VERSION for windows..."

.evergreen/print-compass-env.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#! /usr/bin/env node
21
'use strict';
3-
const path = require('path');
2+
const path = require('node:path');
3+
const fs = require('node:fs');
44

55
/*
66
This script writes a bash script that can be eval()'d in evergreen to modify the
@@ -84,7 +84,11 @@ function printCompassEnv() {
8484
// to be a non-cygwin path
8585
const npmCacheDir = path.resolve(__dirname, '..', '.deps', '.npm-cache');
8686

87-
printVar('ARTIFACTS_PATH', `${newPWD}/.deps`);
87+
const artifactsPath = path.resolve(newPWD, '.deps');
88+
if (!fs.existsSync(artifactsPath)) {
89+
fs.mkdirSync(artifactsPath, { recursive: true });
90+
}
91+
8892
printVar('NPM_CACHE_DIR', npmCacheDir);
8993

9094
// all npm var names need to be lowercase

.evergreen/print-compass-env.sh

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,7 @@
22

33
set -e
44

5-
if [[ $OSTYPE == "cygwin" ]]; then
6-
export PLATFORM='win32'
7-
export IS_WINDOWS=true
8-
export ARCH=x64
9-
elif [[ $(uname) == Darwin ]]; then
10-
export PLATFORM='darwin'
11-
export IS_OSX=true
12-
if [ `uname -m` = x86_64 ]; then
13-
export ARCH=x64
14-
else
15-
export ARCH=arm64
16-
fi
17-
else
18-
export PLATFORM='linux'
19-
export IS_LINUX=true
20-
export ARCH=x64
21-
if [[ $(cat /etc/*release | grep ^NAME | grep Red) ]]; then
22-
export IS_RHEL=true
23-
elif [[ $(cat /etc/*release | grep ^NAME | grep Ubuntu) ]]; then
24-
export IS_UBUNTU=true
25-
fi
26-
fi
5+
source .evergreen/set-platform-env.sh
276

287
export BASHPATH="$PATH"
298
export OSTYPE="$OSTYPE"
@@ -49,5 +28,9 @@ if [[ "${EVERGREEN_PROJECT}" == "10gen-compass-main" ]]; then
4928
fi
5029
fi
5130

52-
53-
.evergreen/print-compass-env.js
31+
# We cannot rely on node from the PATH, as the script we're calling is setting up that PATH.
32+
if [ -n "$IS_WINDOWS" ]; then
33+
.deps/node.exe .evergreen/print-compass-env.js
34+
else
35+
.deps/bin/node .evergreen/print-compass-env.js
36+
fi

.evergreen/print-debug-info.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /usr/bin/env bash
2+
3+
echo "========================="
4+
echo "Important Environment Variables"
5+
echo "========================="
6+
echo "PLATFORM: $PLATFORM"
7+
echo "ARCH: $ARCH"
8+
echo "NODE_JS_VERSION: $NODE_JS_VERSION"
9+
echo "NPM_VERSION: $NPM_VERSION"
10+
echo "APPDATA: $APPDATA"
11+
echo "PATH: $PATH"
12+
13+
# these are super useful if you want to run the smoke tests locally
14+
echo "export DEV_VERSION_IDENTIFIER=$DEV_VERSION_IDENTIFIER"
15+
echo "export EVERGREEN_BUCKET_KEY_PREFIX=$EVERGREEN_BUCKET_KEY_PREFIX"
16+
echo "export EVERGREEN_BUCKET_NAME=$EVERGREEN_BUCKET_NAME"
17+
18+
echo "IS_OSX: $IS_OSX"
19+
echo "IS_LINUX: $IS_LINUX"
20+
echo "IS_WINDOWS: $IS_WINDOWS"
21+
echo "IS_RHEL: $IS_RHEL"
22+
echo "IS_UBUNTU: $IS_UBUNTU"
23+
24+
echo "DOCKER_CONFIG: $DOCKER_CONFIG"

.evergreen/set-platform-env.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /usr/bin/env bash
2+
3+
if [[ $OSTYPE == "cygwin" ]]; then
4+
export PLATFORM='win32'
5+
export IS_WINDOWS=true
6+
export ARCH=x64
7+
elif [[ $(uname) == Darwin ]]; then
8+
export PLATFORM='darwin'
9+
export IS_OSX=true
10+
if [ `uname -m` = x86_64 ]; then
11+
export ARCH=x64
12+
else
13+
export ARCH=arm64
14+
fi
15+
else
16+
export PLATFORM='linux'
17+
export IS_LINUX=true
18+
export ARCH=x64
19+
if [[ $(cat /etc/*release | grep ^NAME | grep Red) ]]; then
20+
export IS_RHEL=true
21+
elif [[ $(cat /etc/*release | grep ^NAME | grep Ubuntu) ]]; then
22+
export IS_UBUNTU=true
23+
fi
24+
fi

0 commit comments

Comments
 (0)