Comparing version 0.0.0-pr-26898-0693e21 to 0.0.0-pr-26898-4cd203d
{ | ||
"name": "nx", | ||
"version": "0.0.0-pr-26898-0693e21", | ||
"version": "0.0.0-pr-26898-4cd203d", | ||
"private": false, | ||
@@ -74,3 +74,3 @@ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", | ||
"ora": "5.3.0", | ||
"@nrwl/tao": "0.0.0-pr-26898-0693e21" | ||
"@nrwl/tao": "0.0.0-pr-26898-4cd203d" | ||
}, | ||
@@ -90,12 +90,12 @@ "peerDependencies": { | ||
"optionalDependencies": { | ||
"@nx/nx-darwin-x64": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-darwin-arm64": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-linux-x64-gnu": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-linux-x64-musl": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-win32-x64-msvc": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-linux-arm64-musl": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-26898-0693e21", | ||
"@nx/nx-freebsd-x64": "0.0.0-pr-26898-0693e21" | ||
"@nx/nx-darwin-x64": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-darwin-arm64": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-linux-x64-gnu": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-linux-x64-musl": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-win32-x64-msvc": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-linux-arm64-musl": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-26898-4cd203d", | ||
"@nx/nx-freebsd-x64": "0.0.0-pr-26898-4cd203d" | ||
}, | ||
@@ -102,0 +102,0 @@ "nx-migrations": { |
@@ -83,3 +83,2 @@ "use strict"; | ||
} | ||
(0, task_graph_utils_1.validateAtomizedTasks)(taskGraph, projectGraph); | ||
return taskGraph; | ||
@@ -86,0 +85,0 @@ } |
import { ProjectGraph } from '../config/project-graph'; | ||
import { TaskGraph } from '../config/task-graph'; | ||
import { Task, TaskGraph } from '../config/task-graph'; | ||
export declare function findCycle(graph: { | ||
@@ -10,2 +10,7 @@ dependencies: Record<string, string[]>; | ||
}): void; | ||
export declare function validateAtomizedTasks(taskGraph: TaskGraph, projectGraph: ProjectGraph): void; | ||
export declare function getAtomizedRootTask(task: Task, taskGraph: TaskGraph, projectGraph: ProjectGraph): { | ||
project: string; | ||
target: string; | ||
configuration?: string; | ||
} | undefined; | ||
export declare function getAtomizerError(atomizedRootTaskId: string, nonAtomizedTask: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateAtomizedTasks = exports.makeAcyclic = exports.findCycle = void 0; | ||
const output_1 = require("../utils/output"); | ||
exports.getAtomizerError = exports.getAtomizedRootTask = exports.makeAcyclic = exports.findCycle = void 0; | ||
const configuration_1 = require("../config/configuration"); | ||
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils"); | ||
const serialize_target_1 = require("../utils/serialize-target"); | ||
function _findCycle(graph, id, visited, path) { | ||
@@ -57,29 +59,39 @@ if (visited[id]) | ||
exports.makeAcyclic = makeAcyclic; | ||
function validateAtomizedTasks(taskGraph, projectGraph) { | ||
if (process.env['NX_SKIP_ATOMIZER_VALIDATION']) { | ||
return; | ||
function getAtomizedRootTask(task, taskGraph, projectGraph) { | ||
const project = projectGraph.nodes[task.target.project]?.data; | ||
const target = project.targets[task.target.target]; | ||
// default case, e2e-ci targets should fail in default task runner | ||
if (target.metadata?.nonAtomizedTarget !== undefined) { | ||
return task.target; | ||
} | ||
const tasksWithAtomizer = Object.values(taskGraph.tasks).filter((task) => projectGraph.nodes[task.target.project]?.data?.targets?.[task.target.target]?.metadata?.nonAtomizedTarget !== undefined); | ||
const isInDTE = process.env['NX_CLOUD_DISTRIBUTED_EXECUTION_ID'] || | ||
process.env['NX_AGENT_NAME']; | ||
if (tasksWithAtomizer.length > 0 && !isInDTE) { | ||
const linkLine = 'Learn more at https://nx.dev/ci/features/split-e2e-tasks#use-atomizer-only-with-nx-cloud-distribution'; | ||
if (tasksWithAtomizer.length === 1) { | ||
output_1.output.error({ | ||
title: `The ${tasksWithAtomizer[0].id} task uses the atomizer and should only be run with Nx Cloud distribution.`, | ||
bodyLines: [linkLine], | ||
}); | ||
const targetGroups = project.metadata?.targetGroups; | ||
if (!targetGroups) { | ||
return undefined; | ||
} | ||
// checking target groups to see if the target is part of at atomized group | ||
for (const group in targetGroups) { | ||
if (targetGroups[group].includes(task.target.target)) { | ||
const rootTarget = targetGroups[group]?.find((t) => task.target.target.startsWith(`${t}--`)); | ||
// we want to fail individual atomized targets only if the root target is also being run | ||
const rootTaskId = (0, serialize_target_1.serializeTarget)(task.target.project, rootTarget, task.target.configuration); | ||
if (rootTarget && | ||
project.targets[rootTarget].metadata?.nonAtomizedTarget !== undefined && | ||
!!taskGraph.tasks[rootTaskId]) { | ||
return taskGraph.tasks[rootTaskId].target; | ||
} | ||
} | ||
else { | ||
output_1.output.error({ | ||
title: `The following tasks use the atomizer and should only be run with Nx Cloud distribution:`, | ||
bodyLines: [ | ||
`${tasksWithAtomizer.map((task) => task.id).join(', ')}`, | ||
linkLine, | ||
], | ||
}); | ||
} | ||
process.exit(1); | ||
} | ||
return undefined; | ||
} | ||
exports.validateAtomizedTasks = validateAtomizedTasks; | ||
exports.getAtomizedRootTask = getAtomizedRootTask; | ||
function getAtomizerError(atomizedRootTaskId, nonAtomizedTask) { | ||
const usingNxCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, configuration_1.readNxJson)()); | ||
const outputLines = [ | ||
`The ${atomizedRootTaskId} task should only be run with ${usingNxCloud ? 'distribution' : 'Nx Cloud'}.`, | ||
'', | ||
`Please enable ${usingNxCloud ? 'distribution with Nx Agents' : 'Nx Cloud'} or use the slower ${nonAtomizedTask} task.`, | ||
'Learn more at https://nx.dev/ci/features/split-e2e-tasks#nx-cloud-is-required-to-run-atomized-tasks', | ||
]; | ||
return outputLines.join('\n'); | ||
} | ||
exports.getAtomizerError = getAtomizerError; |
@@ -18,2 +18,4 @@ "use strict"; | ||
const params_1 = require("../utils/params"); | ||
const task_graph_utils_1 = require("./task-graph-utils"); | ||
const serialize_target_1 = require("../utils/serialize-target"); | ||
class TaskOrchestrator { | ||
@@ -215,3 +217,26 @@ // endregion internal state | ||
const targetConfiguration = (0, utils_1.getTargetConfigurationForTask)(task, this.projectGraph); | ||
if (process.env.NX_RUN_COMMANDS_DIRECTLY !== 'false' && | ||
const atomizedRootTask = (0, task_graph_utils_1.getAtomizedRootTask)(task, this.taskGraph, this.projectGraph); | ||
// disallow running atomized tasks outside of DTE | ||
if (atomizedRootTask && | ||
!process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID && | ||
!env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID) { | ||
let terminalOutput = (0, task_graph_utils_1.getAtomizerError)((0, serialize_target_1.serializeTarget)(atomizedRootTask.project, atomizedRootTask.target, atomizedRootTask.configuration), this.projectGraph.nodes[atomizedRootTask.project]?.data.targets[atomizedRootTask.target]?.metadata.nonAtomizedTarget); | ||
console.error(terminalOutput); | ||
terminalOutput += `\n process env: ${JSON.stringify(process.env)} \n task env: ${JSON.stringify(env)} \n task graph: ${JSON.stringify(this.taskGraph)} \n project graph: ${JSON.stringify(this.projectGraph)}`; | ||
(0, fs_1.writeFileSync)(temporaryOutputPath, terminalOutput); | ||
results.push({ | ||
task, | ||
status: 'failure', | ||
terminalOutput: terminalOutput, | ||
}); | ||
} | ||
else if (targetConfiguration.executor === 'nx:noop') { | ||
(0, fs_1.writeFileSync)(temporaryOutputPath, ''); | ||
results.push({ | ||
task, | ||
status: 'success', | ||
terminalOutput: '', | ||
}); | ||
} | ||
else if (process.env.NX_RUN_COMMANDS_DIRECTLY !== 'false' && | ||
targetConfiguration.executor === 'nx:run-commands' && | ||
@@ -269,10 +294,2 @@ !shouldPrefix) { | ||
} | ||
else if (targetConfiguration.executor === 'nx:noop') { | ||
(0, fs_1.writeFileSync)(temporaryOutputPath, ''); | ||
results.push({ | ||
task, | ||
status: 'success', | ||
terminalOutput: '', | ||
}); | ||
} | ||
else { | ||
@@ -279,0 +296,0 @@ // cache prep |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
7186166
49217
389
+ Added@nrwl/tao@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-darwin-arm64@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-darwin-x64@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-freebsd-x64@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-linux-arm-gnueabihf@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-linux-arm64-gnu@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-linux-arm64-musl@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-linux-x64-gnu@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-linux-x64-musl@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-win32-arm64-msvc@0.0.0-pr-26898-4cd203d(transitive)
+ Added@nx/nx-win32-x64-msvc@0.0.0-pr-26898-4cd203d(transitive)
- Removed@nrwl/tao@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-darwin-arm64@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-darwin-x64@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-freebsd-x64@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-linux-arm-gnueabihf@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-linux-arm64-gnu@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-linux-arm64-musl@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-linux-x64-gnu@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-linux-x64-musl@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-win32-arm64-msvc@0.0.0-pr-26898-0693e21(transitive)
- Removed@nx/nx-win32-x64-msvc@0.0.0-pr-26898-0693e21(transitive)