From 6f341e1993b25d0f990291be58ad4e530b8a9182 Mon Sep 17 00:00:00 2001 From: Le Roux Bodenstein Date: Tue, 14 Jan 2025 11:32:15 +0000 Subject: [PATCH 1/3] Do not use process.env.DEV_VERSION_IDENTIFIER if it is an empty string --- packages/compass-e2e-tests/smoke-test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/compass-e2e-tests/smoke-test.ts b/packages/compass-e2e-tests/smoke-test.ts index c8689507c09..f040c3cfc49 100755 --- a/packages/compass-e2e-tests/smoke-test.ts +++ b/packages/compass-e2e-tests/smoke-test.ts @@ -37,7 +37,8 @@ const argv = yargs(hideBin(process.argv)) // 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, + // NOTE: DEV_VERSION_IDENTIFIER might be a blank string which would be invalid + default: process.env.DEV_VERSION_IDENTIFIER || undefined, description: 'Will be read from packages/compass/package.json if not specified', }) From 00be813f65c74680b9b5ce3d59510d72e8a66499 Mon Sep 17 00:00:00 2001 From: Le Roux Bodenstein Date: Tue, 14 Jan 2025 12:59:17 +0000 Subject: [PATCH 2/3] rather don't set version at all so that we consistently inherit (and test) all the logic in target.js --- packages/compass-e2e-tests/smoke-test.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/packages/compass-e2e-tests/smoke-test.ts b/packages/compass-e2e-tests/smoke-test.ts index f040c3cfc49..23d906ed800 100755 --- a/packages/compass-e2e-tests/smoke-test.ts +++ b/packages/compass-e2e-tests/smoke-test.ts @@ -32,16 +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 - // NOTE: DEV_VERSION_IDENTIFIER might be a blank string which would be invalid - default: process.env.DEV_VERSION_IDENTIFIER || undefined, - description: - 'Will be read from packages/compass/package.json if not specified', - }) .option('platform', { type: 'string', choices: ['win32', 'darwin', 'linux'], @@ -89,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: @@ -113,15 +102,6 @@ async function readJson(...segments: string[]): Promise { 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(); @@ -133,7 +113,6 @@ async function run() { 'skipDownload', 'bucketName', 'bucketKeyPrefix', - 'version', 'platform', 'arch', 'package', @@ -141,15 +120,12 @@ async function run() { ); 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, From b1f94583e517ca158435011ed21abf8dd3c5a10f Mon Sep 17 00:00:00 2001 From: Le Roux Bodenstein Date: Tue, 14 Jan 2025 13:05:04 +0000 Subject: [PATCH 3/3] log env vars known to be used by hadron build info --- packages/compass-e2e-tests/smoke-test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/compass-e2e-tests/smoke-test.ts b/packages/compass-e2e-tests/smoke-test.ts index 23d906ed800..ef175e12df4 100755 --- a/packages/compass-e2e-tests/smoke-test.ts +++ b/packages/compass-e2e-tests/smoke-test.ts @@ -131,6 +131,22 @@ async function run() { 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);