Skip to content

Commit 09c9c26

Browse files
committed
fix(web): always use HOME override as a way to set up evergreen config; clearer arch mapping logic
1 parent 5ee2300 commit 09c9c26

1 file changed

Lines changed: 32 additions & 19 deletions

File tree

packages/compass-web/scripts/spawn-e2e-with-atlas-cloud.mts

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ if (!EVG_USER || !EVG_API_KEY) {
1717
throw new Error('Evergreen credentials missing');
1818
}
1919

20+
function mapArchNameToEvgAssetName(arch = os.arch()) {
21+
switch (arch) {
22+
case 'x64':
23+
return 'amd64';
24+
default:
25+
return arch;
26+
}
27+
}
28+
2029
const OS = os.type().toLowerCase();
21-
const ARCH = os.arch() === 'x64' ? 'amd64' : os.arch();
30+
const ARCH = mapArchNameToEvgAssetName(os.arch());
2231
const CLI_DIR = path.join(os.tmpdir(), crypto.randomUUID());
2332
const EVERGREEN_CONFIG = path.join(CLI_DIR, '.evergreen.yml');
2433

@@ -49,14 +58,27 @@ function spawnEvergreenSync(
4958
args: string[],
5059
extraOptions?: Omit<SpawnSyncOptions, 'encoding'>
5160
) {
52-
const res = spawnSync(EVERGREEN_CLI_BIN, args, {
53-
encoding: 'utf-8',
54-
env: {
55-
...process.env,
56-
...extraOptions?.env,
57-
},
58-
...extraOptions,
59-
});
61+
const res = spawnSync(
62+
EVERGREEN_CLI_BIN,
63+
[
64+
'--level',
65+
'error', // Only allow important logs to reduce the output noise
66+
...args,
67+
],
68+
{
69+
encoding: 'utf-8',
70+
...extraOptions,
71+
env: {
72+
...process.env,
73+
// in theory there is a `--config` flag, but it doesn't seem to work
74+
// specifically with the `user` commands, so we override the HOME to
75+
// make sure that our config is picked up from the "default" dir
76+
// correctly for all cases
77+
HOME: CLI_DIR,
78+
...extraOptions?.env,
79+
},
80+
}
81+
);
6082
if (res.error) {
6183
throw res.error;
6284
}
@@ -111,22 +133,13 @@ console.debug(spawnEvergreenSync(['--version']).stdout.trimEnd());
111133

112134
console.debug(
113135
'current user: %s',
114-
spawnEvergreenSync(['client', 'user'], {
115-
env: {
116-
// in theory there is a `--config` flag, but it doesn't seem to work
117-
// specifically with the `user` commands, so we override the HOME to make
118-
// sure that our config is picked up from the "default" dir correctly
119-
HOME: CLI_DIR,
120-
},
121-
}).stdout.trimEnd()
136+
spawnEvergreenSync(['client', 'user']).stdout.trimEnd()
122137
);
123138

124139
const ATLAS_CLOUD_ENV =
125140
process.env.COMPASS_E2E_ATLAS_CLOUD_ENVIRONMENT ?? 'dev';
126141

127142
const patchInfoStr = spawnEvergreenSync([
128-
'--config',
129-
EVERGREEN_CONFIG,
130143
'patch',
131144
'--project',
132145
'10gen-compass-main',

0 commit comments

Comments
 (0)