Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions packages/compass-e2e-tests/smoke-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ const argv = yargs(hideBin(process.argv))
type: 'string',
default: process.env.EVERGREEN_BUCKET_KEY_PREFIX,
})
.option('version', {
type: 'string',
// For dev versions we need this from evergreen. For beta or stable (or by
// default, ie. when testing a locally packaged app) we get it from the
// package.json
default: process.env.DEV_VERSION_IDENTIFIER,
description:
'Will be read from packages/compass/package.json if not specified',
})
.option('platform', {
type: 'string',
choices: ['win32', 'darwin', 'linux'],
Expand Down Expand Up @@ -88,7 +79,6 @@ const argv = yargs(hideBin(process.argv))
type SmokeTestsContext = {
bucketName?: string;
bucketKeyPrefix?: string;
version?: string;
platform: 'win32' | 'darwin' | 'linux';
arch: 'x64' | 'arm64';
package:
Expand All @@ -112,15 +102,6 @@ async function readJson<T extends object>(...segments: string[]): Promise<T> {
return result as T;
}

async function readPackageVersion(packagePath: string) {
const pkg = await readJson(packagePath, 'package.json');
assert(
'version' in pkg && typeof pkg.version === 'string',
'Expected a package version'
);
return pkg.version;
}

async function run() {
const parsedArgs = argv.parseSync();

Expand All @@ -132,28 +113,40 @@ async function run() {
'skipDownload',
'bucketName',
'bucketKeyPrefix',
'version',
'platform',
'arch',
'package',
])
);

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

// build-info
const infoArgs = {
format: 'json',
dir: compassDir,
version,
platform: context.platform,
arch: context.arch,
out: outPath,
};
console.log('infoArgs', infoArgs);

// These are known environment variables that will affect the way
// writeBuildInfo works. Log them as a reminder and for our own sanity
console.log(
'info env vars',
pick(process.env, [
'HADRON_DISTRIBUTION',
'HADRON_APP_VERSION',
'HADRON_PRODUCT',
'HADRON_PRODUCT_NAME',
'HADRON_READONLY',
'HADRON_ISOLATED',
'DEV_VERSION_IDENTIFIER',
'IS_RHEL',
])
);
writeBuildInfo(infoArgs);
const buildInfo = await readJson(infoArgs.out);

Expand Down
Loading