mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Switch to using the versions from the CI matrix
Incorporates the actual Rush and PNPM versions instead of pinning an old known-good version of PNPM
This commit is contained in:
parent
5f0ad7ecfd
commit
25d966bfa9
1 changed files with 14 additions and 15 deletions
|
|
@ -4,22 +4,21 @@
|
||||||
// and `rushx` invocations correctly. The contents of `rush.json` are just
|
// and `rushx` invocations correctly. The contents of `rush.json` are just
|
||||||
// fixture noise needed to make Rush run at all — Rush's schema requires
|
// fixture noise needed to make Rush run at all — Rush's schema requires
|
||||||
// exact semver for `rushVersion`/`pnpmVersion` and refuses dist-tags like
|
// exact semver for `rushVersion`/`pnpmVersion` and refuses dist-tags like
|
||||||
// "latest", so we resolve those once per suite.
|
// "latest", so we read both back from the binaries baked into the image.
|
||||||
//
|
//
|
||||||
// * `rushVersion` is read from the `rush` binary baked into the image
|
// * `rushVersion` ← `rush --version` (image installs
|
||||||
// (Dockerfile installs `@microsoft/rush@${RUSH_VERSION:-latest}`).
|
// `@microsoft/rush@${RUSH_VERSION:-latest}`).
|
||||||
// * `pnpmVersion` is pinned to a known-good pnpm 9 release. Rush downloads
|
// * `pnpmVersion` ← `pnpm --version` (image installs
|
||||||
// this internally into `~/.rush/...`; it's unrelated to the system
|
// `pnpm@${PNPM_VERSION:-latest}`). Rush downloads its own copy of this
|
||||||
// pnpm exercised by the pnpm e2e suite.
|
// into `~/.rush/...`; using the same exact version as the system pnpm
|
||||||
|
// just keeps the fixture in lockstep with whatever the CI matrix picks.
|
||||||
const PINNED_PNPM_VERSION = "9.15.9";
|
|
||||||
|
|
||||||
/** Resolves the versions to put into `rush.json`. */
|
/** Resolves the versions to put into `rush.json`. */
|
||||||
export async function resolveRushVersions(shell) {
|
export async function resolveRushVersions(shell) {
|
||||||
return {
|
// Sequential: the helper drives a single PTY shell.
|
||||||
rushVersion: await getInstalledRushVersion(shell),
|
const rushVersion = await getInstalledVersion(shell, "rush");
|
||||||
pnpmVersion: PINNED_PNPM_VERSION,
|
const pnpmVersion = await getInstalledVersion(shell, "pnpm");
|
||||||
};
|
return { rushVersion, pnpmVersion };
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Builds the standard `rush.json` body for the e2e fixtures. */
|
/** Builds the standard `rush.json` body for the e2e fixtures. */
|
||||||
|
|
@ -58,12 +57,12 @@ export async function writeTextFile(shell, filePath, content) {
|
||||||
await shell.runCommand(`printf '%s' '${encoded}' | base64 -d > ${filePath}`);
|
await shell.runCommand(`printf '%s' '${encoded}' | base64 -d > ${filePath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getInstalledRushVersion(shell) {
|
async function getInstalledVersion(shell, command) {
|
||||||
const { output } = await shell.runCommand("rush --version");
|
const { output } = await shell.runCommand(`${command} --version`);
|
||||||
const match = output.match(/\b(\d+\.\d+\.\d+)\b/);
|
const match = output.match(/\b(\d+\.\d+\.\d+)\b/);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not determine installed Rush version. Output was:\n${output}`
|
`Could not determine installed ${command} version. Output was:\n${output}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return match[1];
|
return match[1];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue