Skip to content

Commit 67afc54

Browse files
committed
Pass version only for "dev"
1 parent bbf9c12 commit 67afc54

File tree

4 files changed

+17
-39
lines changed

4 files changed

+17
-39
lines changed

.github/workflows/test-installers.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ permissions:
66
on:
77
workflow_dispatch:
88
inputs:
9-
version:
10-
type: string
11-
description: 'Version of the installer to download'
12-
required: true
139
bucket_name:
1410
type: string
1511
description: 'S3 bucket to download installers from'
@@ -18,11 +14,14 @@ on:
1814
type: string
1915
description: 'S3 bucket key prefix to download installers from'
2016
required: true
17+
dev_version:
18+
type: string
19+
description: 'Dev version of the installer to download'
2120
nonce:
2221
type: string
2322
description: 'A random string to track the run from dispatch to watching'
2423

25-
run-name: Test Installers ${{ github.event.inputs.version }} / (nonce = ${{ github.event.inputs.nonce || 'not set' }})
24+
run-name: Test Installers ${{ github.event.inputs.dev_version || github.ref_name }} / (nonce = ${{ github.event.inputs.nonce || 'not set' }})
2625

2726
jobs:
2827
test:
@@ -162,7 +161,7 @@ jobs:
162161
- name: Cache downloads
163162
uses: actions/cache@v4
164163
with:
165-
key: smoke-tests-downloads-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.package }}
164+
key: smoke-tests-downloads-${{ inputs.dev_version || github.ref_name }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.package }}
166165
path: packages/compass-smoke-tests/.downloads
167166
- name: Install dependencies and build packages
168167
run: npm ci
@@ -195,8 +194,8 @@ jobs:
195194
env:
196195
EVERGREEN_BUCKET_NAME: ${{ inputs.bucket_name }}
197196
EVERGREEN_BUCKET_KEY_PREFIX: ${{ inputs.bucket_key_prefix }}
198-
DEV_VERSION_IDENTIFIER: ${{ inputs.version }}
199197
HADRON_DISTRIBUTION: ${{ matrix.hadron-distribution }}
198+
DEV_VERSION_IDENTIFIER: ${{ inputs.dev_version }}
200199
PLATFORM: ${{ matrix.hadron-platform }}
201200
ARCH: ${{ matrix.arch }}
202201
# Useful to pass a "fake" DISTRO_ID environment to inform the "mongodb-download-url" package

packages/compass-smoke-tests/src/build-info.ts

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { handler as writeBuildInfo } from 'hadron-build/commands/info';
88

99
import { type PackageKind } from './packages';
1010
import { type SmokeTestsContextWithSandbox } from './context';
11-
import { createSandbox } from './directories';
1211

1312
const debug = createDebug('compass:smoketests:build-info');
1413
const COMPASS_PATH = path.resolve(__dirname, '../../compass');
@@ -246,6 +245,12 @@ export function writeAndReadPackageDetails({
246245
};
247246
debug({ infoArgs });
248247

248+
// Removing the DEV_VERSION_IDENTIFIER variable if it's empty
249+
// - to avoid any potential (future) issues from CI setting it without providing a value
250+
if (process.env.DEV_VERSION_IDENTIFIER === '') {
251+
delete process.env.DEV_VERSION_IDENTIFIER;
252+
}
253+
249254
// These are known environment variables that will affect the way
250255
// writeBuildInfo works. Log them as a reminder and for our own sanity
251256
debug(
@@ -264,28 +269,3 @@ export function writeAndReadPackageDetails({
264269
writeBuildInfo(infoArgs);
265270
return readPackageDetails(packageKind, infoArgs.out);
266271
}
267-
268-
export function getCompassVersionFromBuildInfo(): string {
269-
const out = path.resolve(createSandbox(), 'target.json');
270-
// We're hardcoding the platform and arch here because we're only interested in the version
271-
if (typeof process.env.HADRON_DISTRIBUTION !== 'string') {
272-
// TODO: Ideally we would interface directly with the `Target` from the "hadron-build" package so we could pass this directly
273-
process.env.HADRON_DISTRIBUTION = 'compass';
274-
}
275-
writeBuildInfo({
276-
format: 'json',
277-
dir: COMPASS_PATH,
278-
platform: 'linux',
279-
arch: 'x64',
280-
out,
281-
});
282-
const result = readJson(out);
283-
assert(typeof result === 'object', 'Expected hadron to write an object');
284-
assert(
285-
'version' in result,
286-
'Expected hadron to write an object with a version'
287-
);
288-
const { version } = result;
289-
assert(typeof version === 'string', 'Expected version to be a string');
290-
return version;
291-
}

packages/compass-smoke-tests/src/cli.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { testAutoUpdateFrom } from './tests/auto-update-from';
1414
import { testAutoUpdateTo } from './tests/auto-update-to';
1515
import { deleteSandboxesDirectory } from './directories';
1616
import { dispatchAndWait, getRefFromGithubPr } from './dispatch';
17-
import { getCompassVersionFromBuildInfo } from './build-info';
1817

1918
const debug = createDebug('compass:smoketests');
2019

@@ -165,7 +164,7 @@ yargs(hideBin(process.argv))
165164
githubPrNumber,
166165
})
167166
: ref,
168-
version: getCompassVersionFromBuildInfo(),
167+
devVersion: process.env.DEV_VERSION_IDENTIFIER,
169168
bucketName,
170169
bucketKeyPrefix,
171170
});

packages/compass-smoke-tests/src/dispatch.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ export async function getRefFromGithubPr({
7373
type DispatchOptions = {
7474
githubToken: string;
7575
ref: string;
76-
version: string;
7776
bucketName: string;
7877
bucketKeyPrefix: string;
78+
devVersion?: string;
7979

8080
/**
8181
* Delay in milliseconds to wait between requests when polling while watching the run.
@@ -86,7 +86,7 @@ type DispatchOptions = {
8686
export async function dispatchAndWait({
8787
githubToken,
8888
ref,
89-
version,
89+
devVersion,
9090
bucketName,
9191
bucketKeyPrefix,
9292
watchPollDelayMs = 5000,
@@ -100,7 +100,7 @@ export async function dispatchAndWait({
100100
workflow_id: GITHUB_WORKFLOW_ID,
101101
ref,
102102
inputs: {
103-
version,
103+
dev_version: devVersion,
104104
bucket_name: bucketName,
105105
bucket_key_prefix: bucketKeyPrefix,
106106
nonce,
@@ -110,7 +110,7 @@ export async function dispatchAndWait({
110110
// Find the next run we just dispatched
111111
const run = await getWorkflowRunRetrying(
112112
octokit,
113-
`Test Installers ${version} / (nonce = ${nonce})`
113+
`Test Installers ${devVersion || ref} / (nonce = ${nonce})`
114114
);
115115

116116
console.log(`Dispatched run #${run.run_number} (${run.html_url})`);

0 commit comments

Comments
 (0)