Skip to content

Commit

Permalink
Pass version only for "dev"
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Feb 24, 2025
1 parent bbf9c12 commit e4f70ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 36 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/test-installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
26 changes: 0 additions & 26 deletions packages/compass-smoke-tests/src/build-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion packages/compass-smoke-tests/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ yargs(hideBin(process.argv))
githubPrNumber,
})
: ref,
version: getCompassVersionFromBuildInfo(),
devVersion: process.env.DEV_VERSION_IDENTIFIER,
bucketName,
bucketKeyPrefix,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/compass-smoke-tests/src/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -86,7 +86,7 @@ type DispatchOptions = {
export async function dispatchAndWait({
githubToken,
ref,
version,
devVersion,
bucketName,
bucketKeyPrefix,
watchPollDelayMs = 5000,
Expand Down

0 comments on commit e4f70ba

Please sign in to comment.