diff --git a/.github/workflows/test-installers.yml b/.github/workflows/test-installers.yml index 6de69ec00c8..86ec4ca0d3b 100644 --- a/.github/workflows/test-installers.yml +++ b/.github/workflows/test-installers.yml @@ -6,10 +6,6 @@ permissions: on: workflow_dispatch: inputs: - version: - type: string - description: 'Version of the installer to download' - required: true bucket_name: type: string description: 'S3 bucket to download installers from' @@ -18,11 +14,14 @@ on: type: string description: 'S3 bucket key prefix to download installers from' required: true + dev_version: + type: string + description: 'Dev version of the installer to download' nonce: type: string description: 'A random string to track the run from dispatch to watching' -run-name: Test Installers ${{ github.event.inputs.version }} / (nonce = ${{ github.event.inputs.nonce || 'not set' }}) +run-name: Test Installers ${{ github.event.inputs.dev_version || github.ref_name }} / (nonce = ${{ github.event.inputs.nonce || 'not set' }}) jobs: test: @@ -162,7 +161,7 @@ jobs: - name: Cache downloads uses: actions/cache@v4 with: - key: smoke-tests-downloads-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.package }} + key: smoke-tests-downloads-${{ inputs.dev_version || github.ref_name }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.package }} path: packages/compass-smoke-tests/.downloads - name: Install dependencies and build packages run: npm ci @@ -191,11 +190,14 @@ jobs: if: matrix.install-update-server run: npm install --no-save --workspace packages/compass-smoke-tests ./compass-mongodb-com + - name: Expose dev version if set + if: inputs.dev_version + run: echo "DEV_VERSION_IDENTIFIER=${{ inputs.dev_version }}" >> $GITHUB_ENV + - name: Run tests env: EVERGREEN_BUCKET_NAME: ${{ inputs.bucket_name }} EVERGREEN_BUCKET_KEY_PREFIX: ${{ inputs.bucket_key_prefix }} - DEV_VERSION_IDENTIFIER: ${{ inputs.version }} HADRON_DISTRIBUTION: ${{ matrix.hadron-distribution }} PLATFORM: ${{ matrix.hadron-platform }} ARCH: ${{ matrix.arch }} diff --git a/packages/compass-smoke-tests/src/build-info.ts b/packages/compass-smoke-tests/src/build-info.ts index bc77ca7172c..acae7acf7cf 100644 --- a/packages/compass-smoke-tests/src/build-info.ts +++ b/packages/compass-smoke-tests/src/build-info.ts @@ -8,7 +8,6 @@ import { handler as writeBuildInfo } from 'hadron-build/commands/info'; import { type PackageKind } from './packages'; import { type SmokeTestsContextWithSandbox } from './context'; -import { createSandbox } from './directories'; const debug = createDebug('compass:smoketests:build-info'); const COMPASS_PATH = path.resolve(__dirname, '../../compass'); @@ -264,28 +263,3 @@ export function writeAndReadPackageDetails({ writeBuildInfo(infoArgs); return readPackageDetails(packageKind, infoArgs.out); } - -export function getCompassVersionFromBuildInfo(): string { - const out = path.resolve(createSandbox(), 'target.json'); - // We're hardcoding the platform and arch here because we're only interested in the version - if (typeof process.env.HADRON_DISTRIBUTION !== 'string') { - // TODO: Ideally we would interface directly with the `Target` from the "hadron-build" package so we could pass this directly - process.env.HADRON_DISTRIBUTION = 'compass'; - } - writeBuildInfo({ - format: 'json', - dir: COMPASS_PATH, - platform: 'linux', - arch: 'x64', - out, - }); - const result = readJson(out); - assert(typeof result === 'object', 'Expected hadron to write an object'); - assert( - 'version' in result, - 'Expected hadron to write an object with a version' - ); - const { version } = result; - assert(typeof version === 'string', 'Expected version to be a string'); - return version; -} diff --git a/packages/compass-smoke-tests/src/cli.ts b/packages/compass-smoke-tests/src/cli.ts index 0abdd1cf292..e83aef45ec3 100755 --- a/packages/compass-smoke-tests/src/cli.ts +++ b/packages/compass-smoke-tests/src/cli.ts @@ -14,7 +14,6 @@ import { testAutoUpdateFrom } from './tests/auto-update-from'; import { testAutoUpdateTo } from './tests/auto-update-to'; import { deleteSandboxesDirectory } from './directories'; import { dispatchAndWait, getRefFromGithubPr } from './dispatch'; -import { getCompassVersionFromBuildInfo } from './build-info'; const debug = createDebug('compass:smoketests'); @@ -165,7 +164,7 @@ yargs(hideBin(process.argv)) githubPrNumber, }) : ref, - version: getCompassVersionFromBuildInfo(), + devVersion: process.env.DEV_VERSION_IDENTIFIER, bucketName, bucketKeyPrefix, }); diff --git a/packages/compass-smoke-tests/src/dispatch.ts b/packages/compass-smoke-tests/src/dispatch.ts index edac0ce3452..ce0bee999dc 100644 --- a/packages/compass-smoke-tests/src/dispatch.ts +++ b/packages/compass-smoke-tests/src/dispatch.ts @@ -73,9 +73,9 @@ export async function getRefFromGithubPr({ type DispatchOptions = { githubToken: string; ref: string; - version: string; bucketName: string; bucketKeyPrefix: string; + devVersion?: string; /** * Delay in milliseconds to wait between requests when polling while watching the run. @@ -86,7 +86,7 @@ type DispatchOptions = { export async function dispatchAndWait({ githubToken, ref, - version, + devVersion, bucketName, bucketKeyPrefix, watchPollDelayMs = 5000, @@ -100,7 +100,7 @@ export async function dispatchAndWait({ workflow_id: GITHUB_WORKFLOW_ID, ref, inputs: { - version, + dev_version: devVersion, bucket_name: bucketName, bucket_key_prefix: bucketKeyPrefix, nonce, @@ -110,7 +110,7 @@ export async function dispatchAndWait({ // Find the next run we just dispatched const run = await getWorkflowRunRetrying( octokit, - `Test Installers ${version} / (nonce = ${nonce})` + `Test Installers ${devVersion || ref} / (nonce = ${nonce})` ); console.log(`Dispatched run #${run.run_number} (${run.html_url})`);