Skip to content

Commit 2f61cda

Browse files
authored
fix(e2e): do not pass version to hadron build info - have it figure it out on its own COMPASS-8812 (#6613)
* Do not use process.env.DEV_VERSION_IDENTIFIER if it is an empty string * rather don't set version at all so that we consistently inherit (and test) all the logic in target.js * log env vars known to be used by hadron build info
1 parent 2c33cd7 commit 2f61cda

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

packages/compass-e2e-tests/smoke-test.ts

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ const argv = yargs(hideBin(process.argv))
7373
type: 'string',
7474
default: process.env.EVERGREEN_BUCKET_KEY_PREFIX,
7575
})
76-
.option('version', {
77-
type: 'string',
78-
// For dev versions we need this from evergreen. For beta or stable (or by
79-
// default, ie. when testing a locally packaged app) we get it from the
80-
// package.json
81-
default: process.env.DEV_VERSION_IDENTIFIER,
82-
description:
83-
'Will be read from packages/compass/package.json if not specified',
84-
})
8576
.option('platform', {
8677
choices: SUPPORTED_PLATFORMS,
8778
demandOption: true,
@@ -127,7 +118,6 @@ const argv = yargs(hideBin(process.argv))
127118
type SmokeTestsContext = {
128119
bucketName?: string;
129120
bucketKeyPrefix?: string;
130-
version?: string;
131121
platform: 'win32' | 'darwin' | 'linux';
132122
arch: 'x64' | 'arm64';
133123
package:
@@ -151,15 +141,6 @@ async function readJson<T extends object>(...segments: string[]): Promise<T> {
151141
return result as T;
152142
}
153143

154-
async function readPackageVersion(packagePath: string) {
155-
const pkg = await readJson(packagePath, 'package.json');
156-
assert(
157-
'version' in pkg && typeof pkg.version === 'string',
158-
'Expected a package version'
159-
);
160-
return pkg.version;
161-
}
162-
163144
async function run() {
164145
const context: SmokeTestsContext = argv.parseSync();
165146

@@ -169,28 +150,40 @@ async function run() {
169150
'skipDownload',
170151
'bucketName',
171152
'bucketKeyPrefix',
172-
'version',
173153
'platform',
174154
'arch',
175155
'package',
176156
])
177157
);
178158

179159
const compassDir = path.resolve(__dirname, '..', '..', 'packages', 'compass');
180-
// use the specified DEV_VERSION_IDENTIFIER if set or load version from packages/compass/package.json
181-
const version = context.version ?? (await readPackageVersion(compassDir));
182160
const outPath = path.resolve(__dirname, 'hadron-build-info.json');
183161

184162
// build-info
185163
const infoArgs = {
186164
format: 'json',
187165
dir: compassDir,
188-
version,
189166
platform: context.platform,
190167
arch: context.arch,
191168
out: outPath,
192169
};
193170
console.log('infoArgs', infoArgs);
171+
172+
// These are known environment variables that will affect the way
173+
// writeBuildInfo works. Log them as a reminder and for our own sanity
174+
console.log(
175+
'info env vars',
176+
pick(process.env, [
177+
'HADRON_DISTRIBUTION',
178+
'HADRON_APP_VERSION',
179+
'HADRON_PRODUCT',
180+
'HADRON_PRODUCT_NAME',
181+
'HADRON_READONLY',
182+
'HADRON_ISOLATED',
183+
'DEV_VERSION_IDENTIFIER',
184+
'IS_RHEL',
185+
])
186+
);
194187
writeBuildInfo(infoArgs);
195188
const buildInfo = await readJson(infoArgs.out);
196189

0 commit comments

Comments
 (0)