fix(core): infer codex environment and use default tasks runner (#31359)
This commit is contained in:
parent
c7a9c71c07
commit
9ab5d820ab
@ -1,4 +1,4 @@
|
||||
import { NxJsonConfiguration } from '@nx/devkit';
|
||||
import { NxJsonConfiguration, readJsonFile, workspaceRoot } from '@nx/devkit';
|
||||
import {
|
||||
cleanupProject,
|
||||
exists,
|
||||
@ -459,7 +459,11 @@ Update the independent packages with a patch, preminor, and prerelease.
|
||||
expect(exists(join(versionPlansDir, 'bump-fixed.md'))).toBe(true);
|
||||
expect(exists(join(versionPlansDir, 'bump-independent.md'))).toBe(true);
|
||||
|
||||
packageInstall('yargs', null, 'latest', 'dev');
|
||||
// Reference the same version of yargs as nx uses to avoid compatibility issues
|
||||
const nxPackageJson = readJsonFile(
|
||||
join(workspaceRoot, 'packages/nx/package.json')
|
||||
);
|
||||
packageInstall('yargs', null, nxPackageJson.dependencies.yargs, 'dev');
|
||||
|
||||
await writeFile(
|
||||
tmpProjPath('release.js'),
|
||||
|
||||
@ -1154,6 +1154,18 @@ function getTasksRunnerPath(
|
||||
runner: string,
|
||||
nxJson: NxJsonConfiguration<string[] | '*'>
|
||||
) {
|
||||
// If running inside of Codex, there will be no internet access, so we cannot use the cloud runner, regardless of other config.
|
||||
// We can infer this scenario by checking for certain environment variables defined in their base image: https://github.com/openai/codex-universal
|
||||
if (process.env.CODEX_ENV_NODE_VERSION) {
|
||||
output.warn({
|
||||
title: 'Codex environment detected, using default tasks runner',
|
||||
bodyLines: [
|
||||
'Codex does not have internet access when it runs tasks, so Nx will use the default tasks runner and only leverage local caching.',
|
||||
],
|
||||
});
|
||||
return defaultTasksRunnerPath;
|
||||
}
|
||||
|
||||
const isCloudRunner =
|
||||
// No tasksRunnerOptions for given --runner
|
||||
nxJson.nxCloudAccessToken ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user