nx 24.0.0-beta.2 → 24.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/post-install.js +5 -3
- package/dist/src/adapter/ngcli-adapter.js +1 -2
- package/dist/src/command-line/add/add.d.ts +2 -0
- package/dist/src/command-line/add/add.js +23 -5
- package/dist/src/command-line/affected/affected.js +2 -2
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -41
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -48
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
- package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +63 -36
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +7 -5
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
- package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
- package/dist/src/command-line/migrate/agentic/select.js +35 -5
- package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
- package/dist/src/command-line/migrate/agentic/types.js +5 -5
- package/dist/src/command-line/migrate/command-object.js +3 -3
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +12 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +26 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +9 -10
- package/dist/src/command-line/migrate/migrate-commits.js +25 -18
- package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
- package/dist/src/command-line/migrate/migrate-output.js +1 -10
- package/dist/src/command-line/migrate/migrate.js +16 -27
- package/dist/src/command-line/migrate/run/agent-output.d.ts +1 -0
- package/dist/src/command-line/migrate/run/agent-output.js +4 -0
- package/dist/src/command-line/migrate/run/broker.js +1 -1
- package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
- package/dist/src/command-line/migrate/run/give-up.js +8 -5
- package/dist/src/command-line/migrate/run/index.d.ts +2 -1
- package/dist/src/command-line/migrate/run/index.js +5 -1
- package/dist/src/command-line/migrate/run/issues.js +7 -2
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +40 -4
- package/dist/src/command-line/migrate/run/orchestrator.js +233 -92
- package/dist/src/command-line/migrate/run/run-state.d.ts +4 -1
- package/dist/src/command-line/migrate/run/run-state.js +20 -2
- package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
- package/dist/src/command-line/migrate/run/runbook.js +99 -21
- package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
- package/dist/src/command-line/migrate/run/state-lock.js +102 -10
- package/dist/src/command-line/migrate/run/util.d.ts +4 -2
- package/dist/src/command-line/migrate/run/util.js +23 -2
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
- package/dist/src/command-line/migrate/run/worker.js +252 -250
- package/dist/src/command-line/release/changelog.js +9 -6
- package/dist/src/command-line/release/config/config.d.ts +1 -0
- package/dist/src/command-line/release/config/config.js +48 -9
- package/dist/src/command-line/release/release.js +2 -2
- package/dist/src/command-line/release/utils/git.js +8 -7
- package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
- package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
- package/dist/src/command-line/release/utils/release-graph.js +1 -0
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
- package/dist/src/command-line/release/utils/shared.js +10 -10
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
- package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +5 -2
- package/dist/src/command-line/show/projects.js +5 -3
- package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
- package/dist/src/config/nx-json.d.ts +8 -5
- package/dist/src/config/workspace-json-project-json.d.ts +12 -9
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/devkit-exports.d.ts +4 -0
- package/dist/src/devkit-exports.js +6 -1
- package/dist/src/devkit-internals.d.ts +1 -1
- package/dist/src/devkit-internals.js +4 -3
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -2
- package/dist/src/executors/run-commands/run-commands.impl.js +20 -10
- package/dist/src/executors/run-commands/running-tasks.d.ts +12 -3
- package/dist/src/executors/run-commands/running-tasks.js +22 -18
- package/dist/src/hasher/check-task-files.js +1 -4
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +7 -6
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
- package/dist/src/native/index.d.ts +3 -3
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -3
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
- package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
- package/dist/src/project-graph/affected/affected-tasks.d.ts +6 -5
- package/dist/src/project-graph/affected/affected-tasks.js +16 -6
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +7 -133
- package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
- package/dist/src/tasks-runner/readiness/probes.js +30 -1
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +31 -10
- package/dist/src/tasks-runner/readiness/ready-when.js +178 -41
- package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -0
- package/dist/src/tasks-runner/task-orchestrator.js +113 -38
- package/dist/src/tasks-runner/tokens.d.ts +54 -0
- package/dist/src/tasks-runner/tokens.js +161 -0
- package/dist/src/tasks-runner/utils.d.ts +15 -1
- package/dist/src/tasks-runner/utils.js +79 -33
- package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
- package/dist/src/utils/acknowledge-build-scripts.js +171 -32
- package/dist/src/utils/long-running-target.d.ts +1 -3
- package/dist/src/utils/long-running-target.js +1 -3
- package/migrations.json +13 -6
- package/package.json +11 -11
- package/schemas/nx-schema.json +17 -11
- package/schemas/project-schema.json +8 -7
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
- package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
- package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/runner.js +0 -262
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
|
@@ -1,38 +1,59 @@
|
|
|
1
1
|
import type { ProjectGraph } from '../../config/project-graph';
|
|
2
2
|
import type { Task, TaskGraph } from '../../config/task-graph';
|
|
3
3
|
import type { ProjectConfiguration, ReadyWhen } from '../../config/workspace-json-project-json';
|
|
4
|
-
export
|
|
4
|
+
export declare const DEFAULT_READY_TIMEOUT = 60000;
|
|
5
|
+
type ReadyWhenProbe<Deferred> = {
|
|
5
6
|
timeout: number;
|
|
6
7
|
interval?: number;
|
|
7
8
|
} & ({
|
|
8
9
|
kind: 'url';
|
|
9
|
-
url: string;
|
|
10
|
+
url: string | Deferred;
|
|
10
11
|
} | {
|
|
11
12
|
kind: 'port';
|
|
12
|
-
port: number;
|
|
13
|
-
host?: string;
|
|
13
|
+
port: number | Deferred;
|
|
14
|
+
host?: string | Deferred;
|
|
14
15
|
} | {
|
|
15
16
|
kind: 'command';
|
|
16
|
-
command: string;
|
|
17
|
+
command: string | Deferred;
|
|
17
18
|
} | {
|
|
18
19
|
kind: 'logMatches';
|
|
19
|
-
logMatches: string[];
|
|
20
|
+
logMatches: (string | Deferred)[];
|
|
20
21
|
});
|
|
22
|
+
export type NormalizedReadyWhen = ReadyWhenProbe<never>;
|
|
23
|
+
export interface ReadyWhenWait {
|
|
24
|
+
timeout: number;
|
|
25
|
+
description: string;
|
|
26
|
+
}
|
|
21
27
|
export interface ReadyWhenData {
|
|
22
28
|
workspaceRoot: string;
|
|
23
29
|
projectRoot: string;
|
|
24
30
|
projectName: string;
|
|
25
31
|
options: Record<string, unknown>;
|
|
32
|
+
env: () => NodeJS.ProcessEnv;
|
|
26
33
|
}
|
|
27
|
-
export declare function normalizeReadyWhen(readyWhen: ReadyWhen, taskId: string, data: ReadyWhenData): NormalizedReadyWhen;
|
|
28
|
-
|
|
34
|
+
export declare function normalizeReadyWhen(readyWhen: ReadyWhen, taskId: string, data: ReadyWhenData): NormalizedReadyWhen | null;
|
|
35
|
+
/**
|
|
36
|
+
* Checks a producer's probe without the env the producer runs with. A value
|
|
37
|
+
* that reads that env is left to getReadyWhen in the process that runs the
|
|
38
|
+
* producer, and every other value is checked the way getReadyWhen checks it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkReadyWhen(readyWhen: ReadyWhen, taskId: string, data: Omit<ReadyWhenData, 'env'>): ReadyWhenWait;
|
|
41
|
+
export declare function readinessTimeoutError(taskId: string, readyWhen: NormalizedReadyWhen | ReadyWhenWait): Error;
|
|
29
42
|
export declare class ProducerFailedError extends Error {
|
|
30
43
|
constructor(taskId: string);
|
|
31
44
|
}
|
|
32
45
|
export declare class NotReadyError extends Error {
|
|
33
46
|
}
|
|
47
|
+
export declare class InvalidReadyWhenError extends Error {
|
|
48
|
+
}
|
|
34
49
|
export declare function notReadyError(taskId: string, reason: 'exited' | 'was stopped' | 'failed'): Error;
|
|
35
|
-
export declare function getReadyWhenConfig(task: Task, projectGraph: ProjectGraph): ReadyWhen | undefined;
|
|
36
|
-
|
|
50
|
+
export declare function getReadyWhenConfig(task: Task, projectGraph: ProjectGraph): ReadyWhen | null | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The probe of a producer this process starts with `taskEnv`. Env tokens read
|
|
53
|
+
* `taskEnv`, or for run-commands the env its command runs with
|
|
54
|
+
*/
|
|
55
|
+
export declare function getReadyWhen(task: Task, projectGraph: ProjectGraph, projects: Record<string, ProjectConfiguration>, workspaceRoot: string, taskEnv: NodeJS.ProcessEnv): NormalizedReadyWhen | null;
|
|
56
|
+
export declare function getReadyWhenWait(task: Task, projectGraph: ProjectGraph, projects: Record<string, ProjectConfiguration>, workspaceRoot: string): ReadyWhenWait | null;
|
|
37
57
|
export declare function getReadyProducerIds(task: Task, taskGraph: TaskGraph): string[];
|
|
38
58
|
export declare function getReadyDependencies(taskGraph: TaskGraph, projectGraph: ProjectGraph): Record<string, string[]>;
|
|
59
|
+
export {};
|
|
@@ -1,48 +1,111 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotReadyError = exports.ProducerFailedError = void 0;
|
|
3
|
+
exports.InvalidReadyWhenError = exports.NotReadyError = exports.ProducerFailedError = exports.DEFAULT_READY_TIMEOUT = void 0;
|
|
4
4
|
exports.normalizeReadyWhen = normalizeReadyWhen;
|
|
5
|
+
exports.checkReadyWhen = checkReadyWhen;
|
|
5
6
|
exports.readinessTimeoutError = readinessTimeoutError;
|
|
6
7
|
exports.notReadyError = notReadyError;
|
|
7
8
|
exports.getReadyWhenConfig = getReadyWhenConfig;
|
|
8
9
|
exports.getReadyWhen = getReadyWhen;
|
|
10
|
+
exports.getReadyWhenWait = getReadyWhenWait;
|
|
9
11
|
exports.getReadyProducerIds = getReadyProducerIds;
|
|
10
12
|
exports.getReadyDependencies = getReadyDependencies;
|
|
11
13
|
const path_1 = require("path");
|
|
12
14
|
const params_1 = require("../../utils/params");
|
|
15
|
+
const tokens_1 = require("../tokens");
|
|
13
16
|
const utils_1 = require("../utils");
|
|
14
|
-
|
|
17
|
+
exports.DEFAULT_READY_TIMEOUT = 60_000;
|
|
15
18
|
// Node timers take at most a signed 32-bit count of milliseconds
|
|
16
19
|
const MAX_DURATION = 2_147_483_647;
|
|
17
20
|
const PROBE_KEYS = ['url', 'port', 'command', 'logMatches'];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
class EnvUnknownHere extends Error {
|
|
22
|
+
}
|
|
23
|
+
// A value that reads the producer's env. It keeps its written form, and
|
|
24
|
+
// getReadyWhen checks it in the process that runs the producer
|
|
25
|
+
class EnvDeferred {
|
|
26
|
+
constructor(written) {
|
|
27
|
+
this.written = written;
|
|
28
|
+
}
|
|
29
|
+
toString() {
|
|
30
|
+
return this.written;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// `options` and `env` are tokens only with a path, so shell text such as
|
|
34
|
+
// `${options}` stays as written
|
|
35
|
+
const PATHLESS_TOKENS = new Set([
|
|
36
|
+
'workspaceRoot',
|
|
37
|
+
'projectRoot',
|
|
38
|
+
'projectName',
|
|
39
|
+
]);
|
|
21
40
|
function normalizeReadyWhen(readyWhen, taskId, data) {
|
|
22
|
-
const
|
|
41
|
+
const probe = resolveReadyWhen(readyWhen, taskId, data);
|
|
42
|
+
// Only checkReadyWhen's env throws EnvUnknownHere, so nothing is deferred
|
|
43
|
+
return probe.kind === 'serverPicksPort'
|
|
44
|
+
? null
|
|
45
|
+
: probe;
|
|
46
|
+
}
|
|
47
|
+
function resolveReadyWhen(readyWhen, taskId, data) {
|
|
48
|
+
const invalid = (reason) => new InvalidReadyWhenError(`Task "${taskId}" has an invalid "readyWhen": ${reason}.`);
|
|
23
49
|
if (typeof readyWhen !== 'object' || readyWhen === null) {
|
|
24
50
|
throw invalid('expected an object');
|
|
25
51
|
}
|
|
26
52
|
const config = readyWhen;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
const scope = {
|
|
54
|
+
isToken: (name, path) => path === undefined
|
|
55
|
+
? PATHLESS_TOKENS.has(name)
|
|
56
|
+
: name === 'options' || name === 'env',
|
|
57
|
+
read: (name, path) => (0, tokens_1.readPath)(data[name], path),
|
|
58
|
+
env: { read: data.env },
|
|
59
|
+
noValue: (token) => {
|
|
60
|
+
throw invalid(`"${token}" has no value`);
|
|
61
|
+
},
|
|
62
|
+
toText: (value, token) => {
|
|
63
|
+
if (!['string', 'number', 'boolean'].includes(typeof value)) {
|
|
64
|
+
throw invalid(`"${token}" is not a string or a number`);
|
|
35
65
|
}
|
|
36
|
-
|
|
37
|
-
|
|
66
|
+
return String(value);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
// A flag passed without a value parses as `true`, and no host or port is a
|
|
70
|
+
// boolean
|
|
71
|
+
const hostScope = {
|
|
72
|
+
...scope,
|
|
73
|
+
isUnset: (value) => typeof value === 'boolean',
|
|
74
|
+
};
|
|
75
|
+
// The Rspack dev server reads an empty port option as 0. An empty env var
|
|
76
|
+
// stays unset.
|
|
77
|
+
const portScope = {
|
|
78
|
+
...hostScope,
|
|
79
|
+
read: (name, path) => {
|
|
80
|
+
const value = scope.read(name, path);
|
|
81
|
+
return value === '' ? 0 : value;
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
const resolve = (value, tokenScope = scope) => {
|
|
85
|
+
if (typeof value !== 'string') {
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
let nodes;
|
|
89
|
+
try {
|
|
90
|
+
nodes = (0, tokens_1.parseTokens)(value, tokenScope);
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
throw invalid(e.message);
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
return (0, tokens_1.renderTokens)(nodes, tokenScope);
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
if (e instanceof EnvUnknownHere) {
|
|
100
|
+
return new EnvDeferred(value);
|
|
38
101
|
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
102
|
+
throw e;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
42
105
|
// Braces are never valid in a host or port once resolved, so a leftover is
|
|
43
106
|
// a typo. A url keeps them: they are legal in its path and query.
|
|
44
|
-
const resolveWithoutBraces = (key) => {
|
|
45
|
-
const value = resolve(config[key]);
|
|
107
|
+
const resolveWithoutBraces = (key, tokenScope) => {
|
|
108
|
+
const value = resolve(config[key], tokenScope);
|
|
46
109
|
if (typeof value === 'string' && /[{}]/.test(value)) {
|
|
47
110
|
throw invalid(`"${key}" contains an unknown placeholder`);
|
|
48
111
|
}
|
|
@@ -52,7 +115,7 @@ function normalizeReadyWhen(readyWhen, taskId, data) {
|
|
|
52
115
|
if (present.length !== 1) {
|
|
53
116
|
throw invalid(`expected exactly one of ${PROBE_KEYS.map((k) => `"${k}"`).join(', ')}`);
|
|
54
117
|
}
|
|
55
|
-
const timeout = config.timeout ?? DEFAULT_READY_TIMEOUT;
|
|
118
|
+
const timeout = config.timeout ?? exports.DEFAULT_READY_TIMEOUT;
|
|
56
119
|
if (!isDuration(timeout)) {
|
|
57
120
|
throw invalid(`"timeout" must be an integer from 1 to ${MAX_DURATION}`);
|
|
58
121
|
}
|
|
@@ -66,31 +129,41 @@ function normalizeReadyWhen(readyWhen, taskId, data) {
|
|
|
66
129
|
switch (present[0]) {
|
|
67
130
|
case 'url': {
|
|
68
131
|
const url = resolve(config.url);
|
|
69
|
-
if (
|
|
132
|
+
if (!(url instanceof EnvDeferred) &&
|
|
133
|
+
(typeof url !== 'string' || !isHttpUrl(url))) {
|
|
70
134
|
throw invalid('"url" must be an http or https URL');
|
|
71
135
|
}
|
|
72
136
|
return { kind: 'url', url, ...shared };
|
|
73
137
|
}
|
|
74
138
|
case 'port': {
|
|
75
|
-
let port = resolveWithoutBraces('port');
|
|
139
|
+
let port = resolveWithoutBraces('port', portScope);
|
|
76
140
|
if (typeof port === 'string' && /^\d+$/.test(port)) {
|
|
77
141
|
port = Number(port);
|
|
78
142
|
}
|
|
79
|
-
if (
|
|
80
|
-
|
|
143
|
+
if (port !== 0 &&
|
|
144
|
+
port !== 'auto' &&
|
|
145
|
+
!(port instanceof EnvDeferred) &&
|
|
146
|
+
(!isPositiveInteger(port) || port > 65535)) {
|
|
147
|
+
throw invalid('"port" must be an integer from 0 to 65535, or "auto"');
|
|
81
148
|
}
|
|
82
|
-
const host = resolveWithoutBraces('host');
|
|
149
|
+
const host = resolveWithoutBraces('host', hostScope);
|
|
83
150
|
if (host == null) {
|
|
84
|
-
return
|
|
151
|
+
return port === 0 || port === 'auto'
|
|
152
|
+
? { kind: 'serverPicksPort', port, ...shared }
|
|
153
|
+
: { kind: 'port', port, ...shared };
|
|
85
154
|
}
|
|
86
|
-
if (
|
|
155
|
+
if (!(host instanceof EnvDeferred) &&
|
|
156
|
+
(typeof host !== 'string' || !host)) {
|
|
87
157
|
throw invalid('"host" must be a non-empty string');
|
|
88
158
|
}
|
|
89
|
-
return
|
|
159
|
+
return port === 0 || port === 'auto'
|
|
160
|
+
? { kind: 'serverPicksPort', port, host, ...shared }
|
|
161
|
+
: { kind: 'port', port, host, ...shared };
|
|
90
162
|
}
|
|
91
163
|
case 'command': {
|
|
92
164
|
const command = resolve(config.command);
|
|
93
|
-
if (
|
|
165
|
+
if (!(command instanceof EnvDeferred) &&
|
|
166
|
+
(typeof command !== 'string' || !command)) {
|
|
94
167
|
throw invalid('"command" must be a non-empty string');
|
|
95
168
|
}
|
|
96
169
|
return { kind: 'command', command, ...shared };
|
|
@@ -98,17 +171,36 @@ function normalizeReadyWhen(readyWhen, taskId, data) {
|
|
|
98
171
|
case 'logMatches': {
|
|
99
172
|
const logMatches = (Array.isArray(config.logMatches)
|
|
100
173
|
? config.logMatches
|
|
101
|
-
: [config.logMatches]).map(resolve);
|
|
174
|
+
: [config.logMatches]).map((match) => resolve(match));
|
|
102
175
|
if (logMatches.length === 0 ||
|
|
103
|
-
!logMatches.every((m) => typeof m === 'string' && !!m)) {
|
|
176
|
+
!logMatches.every((m) => m instanceof EnvDeferred || (typeof m === 'string' && !!m))) {
|
|
104
177
|
throw invalid('"logMatches" must be a non-empty string or an array of them');
|
|
105
178
|
}
|
|
106
179
|
return { kind: 'logMatches', logMatches, ...shared };
|
|
107
180
|
}
|
|
108
181
|
}
|
|
109
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Checks a producer's probe without the env the producer runs with. A value
|
|
185
|
+
* that reads that env is left to getReadyWhen in the process that runs the
|
|
186
|
+
* producer, and every other value is checked the way getReadyWhen checks it.
|
|
187
|
+
*/
|
|
188
|
+
function checkReadyWhen(readyWhen, taskId, data) {
|
|
189
|
+
const probe = resolveReadyWhen(readyWhen, taskId, {
|
|
190
|
+
...data,
|
|
191
|
+
env: () => {
|
|
192
|
+
throw new EnvUnknownHere();
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
return {
|
|
196
|
+
timeout: probe.timeout,
|
|
197
|
+
description: describeReadyWhen(probe),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
110
200
|
function readinessTimeoutError(taskId, readyWhen) {
|
|
111
|
-
|
|
201
|
+
const description = 'kind' in readyWhen ? describeReadyWhen(readyWhen) : readyWhen.description;
|
|
202
|
+
return new Error(`Task "${taskId}" did not become ready within ${readyWhen.timeout}ms (readyWhen: ${description}). ` +
|
|
203
|
+
'To change the check, set "readyWhen" on the target or in "targetDefaults" in nx.json, or set it to null to turn it off.');
|
|
112
204
|
}
|
|
113
205
|
// The row carries only the status; the owner reports the reason
|
|
114
206
|
class ProducerFailedError extends Error {
|
|
@@ -121,6 +213,9 @@ exports.ProducerFailedError = ProducerFailedError;
|
|
|
121
213
|
class NotReadyError extends Error {
|
|
122
214
|
}
|
|
123
215
|
exports.NotReadyError = NotReadyError;
|
|
216
|
+
class InvalidReadyWhenError extends Error {
|
|
217
|
+
}
|
|
218
|
+
exports.InvalidReadyWhenError = InvalidReadyWhenError;
|
|
124
219
|
function notReadyError(taskId, reason) {
|
|
125
220
|
return new NotReadyError(`Task "${taskId}" ${reason} before it became ready.`);
|
|
126
221
|
}
|
|
@@ -129,6 +224,7 @@ function describeReadyWhen(readyWhen) {
|
|
|
129
224
|
case 'url':
|
|
130
225
|
return `url ${readyWhen.url}`;
|
|
131
226
|
case 'port':
|
|
227
|
+
case 'serverPicksPort':
|
|
132
228
|
return readyWhen.host
|
|
133
229
|
? `port ${readyWhen.host}:${readyWhen.port}`
|
|
134
230
|
: `port ${readyWhen.port}`;
|
|
@@ -146,9 +242,45 @@ function getReadyWhenConfig(task, projectGraph) {
|
|
|
146
242
|
}
|
|
147
243
|
return projectGraph.nodes[task.target.project]?.data?.targets?.[task.target.target]?.readyWhen;
|
|
148
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* The probe of a producer this process starts with `taskEnv`. Env tokens read
|
|
247
|
+
* `taskEnv`, or for run-commands the env its command runs with
|
|
248
|
+
*/
|
|
249
|
+
function getReadyWhen(task, projectGraph, projects, workspaceRoot, taskEnv) {
|
|
250
|
+
const inputs = getReadyWhenInputs(task, projectGraph, projects, workspaceRoot);
|
|
251
|
+
if (!inputs) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
const { readyWhen, executor, data } = inputs;
|
|
255
|
+
const { options } = data;
|
|
256
|
+
let commandEnv;
|
|
257
|
+
return normalizeReadyWhen(readyWhen, task.id, {
|
|
258
|
+
...data,
|
|
259
|
+
env: () => {
|
|
260
|
+
if (executor !== 'nx:run-commands') {
|
|
261
|
+
return taskEnv;
|
|
262
|
+
}
|
|
263
|
+
if (commandEnv) {
|
|
264
|
+
return commandEnv;
|
|
265
|
+
}
|
|
266
|
+
// Required lazily, so loading run-command.ts doesn't also load the
|
|
267
|
+
// run-commands executor
|
|
268
|
+
const { calculateCwd, processEnv } = require('../../executors/run-commands/running-tasks');
|
|
269
|
+
commandEnv = processEnv(options.color, calculateCwd(options.cwd, {
|
|
270
|
+
root: workspaceRoot,
|
|
271
|
+
}), (options.env ?? {}), options.envFile, taskEnv);
|
|
272
|
+
return commandEnv;
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
// The probe of a producer another process may run
|
|
277
|
+
function getReadyWhenWait(task, projectGraph, projects, workspaceRoot) {
|
|
278
|
+
const inputs = getReadyWhenInputs(task, projectGraph, projects, workspaceRoot);
|
|
279
|
+
return inputs && checkReadyWhen(inputs.readyWhen, task.id, inputs.data);
|
|
280
|
+
}
|
|
149
281
|
// Placeholders resolve against the options the executor receives: aliases,
|
|
150
282
|
// schema defaults and the spelling of command-line overrides applied
|
|
151
|
-
function
|
|
283
|
+
function getReadyWhenInputs(task, projectGraph, projects, workspaceRoot) {
|
|
152
284
|
const readyWhen = getReadyWhenConfig(task, projectGraph);
|
|
153
285
|
if (readyWhen == null) {
|
|
154
286
|
return null;
|
|
@@ -156,12 +288,17 @@ function getReadyWhen(task, projectGraph, projects, workspaceRoot) {
|
|
|
156
288
|
const node = projectGraph.nodes[task.target.project];
|
|
157
289
|
const target = node.data.targets[task.target.target];
|
|
158
290
|
const { schema } = (0, utils_1.getExecutorForTask)(task, projects);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
291
|
+
const options = (0, params_1.combineOptionsForExecutor)(task.overrides, task.target.configuration ?? target.defaultConfiguration, target, schema, task.target.project, (0, path_1.relative)(task.projectRoot ?? workspaceRoot, process.cwd()), process.env.NX_VERBOSE_LOGGING === 'true');
|
|
292
|
+
return {
|
|
293
|
+
readyWhen,
|
|
294
|
+
executor: target.executor,
|
|
295
|
+
data: {
|
|
296
|
+
workspaceRoot,
|
|
297
|
+
projectRoot: node.data.root,
|
|
298
|
+
projectName: node.name,
|
|
299
|
+
options,
|
|
300
|
+
},
|
|
301
|
+
};
|
|
165
302
|
}
|
|
166
303
|
function getReadyProducerIds(task, taskGraph) {
|
|
167
304
|
return (taskGraph.continuousDependencies[task.id] ?? [])
|
|
@@ -271,6 +271,9 @@ export declare class TaskOrchestrator {
|
|
|
271
271
|
private runTaskInForkedProcess;
|
|
272
272
|
startContinuousTask(task: Task, groupId: number): Promise<NoopChildProcess | RunningTask | SharedRunningTask>;
|
|
273
273
|
private getReadyWhen;
|
|
274
|
+
private getReadyWhenWait;
|
|
275
|
+
private getReadinessCheck;
|
|
276
|
+
private warnUncheckedReadiness;
|
|
274
277
|
private waitForReadyDependencies;
|
|
275
278
|
private onReadinessHold;
|
|
276
279
|
private pollReadinessRow;
|
|
@@ -279,6 +282,7 @@ export declare class TaskOrchestrator {
|
|
|
279
282
|
private hasReadyWaiter;
|
|
280
283
|
private skipWaiter;
|
|
281
284
|
private recordReadiness;
|
|
285
|
+
private publishReadiness;
|
|
282
286
|
private readinessOf;
|
|
283
287
|
private armReadiness;
|
|
284
288
|
private abortReadiness;
|
|
@@ -1148,27 +1148,21 @@ class TaskOrchestrator {
|
|
|
1148
1148
|
try {
|
|
1149
1149
|
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projects);
|
|
1150
1150
|
const combinedOptions = (0, params_1.combineOptionsForExecutor)(task.overrides, task.target.configuration ?? targetConfiguration.defaultConfiguration, targetConfiguration, schema, task.target.project, (0, path_1.relative)(task.projectRoot ?? workspace_root_1.workspaceRoot, process.cwd()), process.env.NX_VERBOSE_LOGGING === 'true');
|
|
1151
|
-
if (combinedOptions.env) {
|
|
1152
|
-
env = {
|
|
1153
|
-
...env,
|
|
1154
|
-
...combinedOptions.env,
|
|
1155
|
-
};
|
|
1156
|
-
}
|
|
1157
1151
|
if (streamOutput) {
|
|
1158
1152
|
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
|
1159
1153
|
output_1.output.logCommand(args.join(' '));
|
|
1160
1154
|
}
|
|
1161
1155
|
const runCommandsOptions = {
|
|
1162
1156
|
...combinedOptions,
|
|
1163
|
-
env,
|
|
1164
1157
|
usePty: this.tuiEnabled ||
|
|
1165
1158
|
(!this.tasksSchedule.hasTasks() &&
|
|
1166
1159
|
this.runningContinuousTasks.size === 0),
|
|
1167
1160
|
streamOutput: streamOutput && !shouldPrefix,
|
|
1168
1161
|
};
|
|
1162
|
+
// As in a forked run, run-commands builds its env on the task env
|
|
1169
1163
|
const runningTask = await (0, run_commands_impl_1.runCommands)(runCommandsOptions, {
|
|
1170
1164
|
root: workspace_root_1.workspaceRoot, // only root is needed in runCommands
|
|
1171
|
-
}, task);
|
|
1165
|
+
}, task, env);
|
|
1172
1166
|
this.runningRunCommandsTasks.set(task.id, runningTask);
|
|
1173
1167
|
runningTask.onExit(() => {
|
|
1174
1168
|
this.runningRunCommandsTasks.delete(task.id);
|
|
@@ -1309,8 +1303,9 @@ class TaskOrchestrator {
|
|
|
1309
1303
|
if (this.runningTasksService &&
|
|
1310
1304
|
this.runningTasksService.getRunningTasks([task.id]).length) {
|
|
1311
1305
|
let readyWhen;
|
|
1306
|
+
let uncheckedReason;
|
|
1312
1307
|
try {
|
|
1313
|
-
readyWhen = this.
|
|
1308
|
+
({ readyWhen, uncheckedReason } = this.getReadinessCheck(task, () => this.getReadyWhenWait(task)));
|
|
1314
1309
|
}
|
|
1315
1310
|
catch (e) {
|
|
1316
1311
|
return this.failTaskBeforeStart(task, groupId, e);
|
|
@@ -1320,6 +1315,9 @@ class TaskOrchestrator {
|
|
|
1320
1315
|
this.options.lifeCycle.setTaskStatus(task.id, 8 /* NativeTaskStatus.Shared */);
|
|
1321
1316
|
}
|
|
1322
1317
|
const runningTask = new shared_running_task_1.SharedRunningTask(this.runningTasksService, task.id);
|
|
1318
|
+
if (uncheckedReason) {
|
|
1319
|
+
this.warnUncheckedReadiness(task, uncheckedReason);
|
|
1320
|
+
}
|
|
1323
1321
|
if (readyWhen) {
|
|
1324
1322
|
const state = this.armReadiness(task.id);
|
|
1325
1323
|
this.pollReadinessRow(task, readyWhen, state.abort.signal, true).then(() => {
|
|
@@ -1352,11 +1350,31 @@ class TaskOrchestrator {
|
|
|
1352
1350
|
// asking the same question is told the task is not running and starts a
|
|
1353
1351
|
// duplicate of it.
|
|
1354
1352
|
this.runningTasksService?.addRunningTask(task.id);
|
|
1355
|
-
let
|
|
1353
|
+
let pipeOutput;
|
|
1354
|
+
let temporaryOutputPath;
|
|
1355
|
+
let streamOutput;
|
|
1356
|
+
let env;
|
|
1356
1357
|
let readyWhen;
|
|
1358
|
+
let uncheckedReason;
|
|
1359
|
+
let readyOnStart;
|
|
1357
1360
|
try {
|
|
1358
|
-
taskSpecificEnv = await this.processedTasks.get(task.id);
|
|
1359
|
-
|
|
1361
|
+
const taskSpecificEnv = await this.processedTasks.get(task.id);
|
|
1362
|
+
pipeOutput = await this.pipeOutputCapture(task);
|
|
1363
|
+
// obtain metadata
|
|
1364
|
+
temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
|
1365
|
+
// Deliberately not gated on `printsTaskOutput`, unlike `runTaskDirectly`.
|
|
1366
|
+
// `SummaryTerminalOutputLifeCycle.printTaskTerminalOutput` is a no-op and it
|
|
1367
|
+
// only reports at `endCommand`, which never runs for a task that does not
|
|
1368
|
+
// end - so suppressing here would leave a `nx serve` under `summary` with a
|
|
1369
|
+
// permanently silent terminal and no file to read yet. Streaming is the only
|
|
1370
|
+
// channel a continuous task has.
|
|
1371
|
+
streamOutput = (0, output_1.isStaticOutputStyle)(this.specifiedOutputStyle)
|
|
1372
|
+
? false
|
|
1373
|
+
: (0, utils_1.shouldStreamOutput)(task, this.initiatingProject);
|
|
1374
|
+
env = pipeOutput
|
|
1375
|
+
? (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, (0, task_env_1.getForceColorForChild)(), this.options.skipNxCache, this.options.captureStderr, null, null)
|
|
1376
|
+
: (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, undefined, this.options.skipNxCache, this.options.captureStderr, temporaryOutputPath, streamOutput);
|
|
1377
|
+
({ readyWhen, uncheckedReason, readyOnStart } = this.getReadinessCheck(task, () => this.getReadyWhen(task, env)));
|
|
1360
1378
|
await this.waitForReadyDependencies(task);
|
|
1361
1379
|
}
|
|
1362
1380
|
catch (e) {
|
|
@@ -1375,27 +1393,23 @@ class TaskOrchestrator {
|
|
|
1375
1393
|
let childProcess;
|
|
1376
1394
|
try {
|
|
1377
1395
|
await this.preRunSteps([task], { groupId });
|
|
1378
|
-
const pipeOutput = await this.pipeOutputCapture(task);
|
|
1379
|
-
// obtain metadata
|
|
1380
|
-
const temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
|
1381
|
-
// Deliberately not gated on `printsTaskOutput`, unlike `runTaskDirectly`.
|
|
1382
|
-
// `SummaryTerminalOutputLifeCycle.printTaskTerminalOutput` is a no-op and it
|
|
1383
|
-
// only reports at `endCommand`, which never runs for a task that does not
|
|
1384
|
-
// end - so suppressing here would leave a `nx serve` under `summary` with a
|
|
1385
|
-
// permanently silent terminal and no file to read yet. Streaming is the only
|
|
1386
|
-
// channel a continuous task has.
|
|
1387
|
-
const streamOutput = (0, output_1.isStaticOutputStyle)(this.specifiedOutputStyle)
|
|
1388
|
-
? false
|
|
1389
|
-
: (0, utils_1.shouldStreamOutput)(task, this.initiatingProject);
|
|
1390
|
-
let env = pipeOutput
|
|
1391
|
-
? (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, (0, task_env_1.getForceColorForChild)(), this.options.skipNxCache, this.options.captureStderr, null, null)
|
|
1392
|
-
: (0, task_env_1.getEnvVariablesForTask)(task, taskSpecificEnv, undefined, this.options.skipNxCache, this.options.captureStderr, temporaryOutputPath, streamOutput);
|
|
1393
1396
|
this.detectTaskInvocationLoop(task);
|
|
1394
1397
|
childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
1395
1398
|
this.tasksSchedule.markContinuousTaskStarted(task.id);
|
|
1399
|
+
if (uncheckedReason) {
|
|
1400
|
+
this.warnUncheckedReadiness(task, uncheckedReason);
|
|
1401
|
+
// No probe settles the row, and a waiter in another process polls it
|
|
1402
|
+
this.publishReadiness(task, 2 /* TaskReadiness.Failed */);
|
|
1403
|
+
}
|
|
1396
1404
|
if (readyWhen) {
|
|
1397
1405
|
this.startReadinessProbe(task, readyWhen, childProcess);
|
|
1398
1406
|
}
|
|
1407
|
+
// Waiters here, in other processes and in the TUI hold on a configured
|
|
1408
|
+
// readyWhen until it gets a verdict
|
|
1409
|
+
if (readyOnStart) {
|
|
1410
|
+
this.recordReadiness(task, 1 /* TaskReadiness.Ready */);
|
|
1411
|
+
this.armReadiness(task.id).resolve();
|
|
1412
|
+
}
|
|
1399
1413
|
this.runningContinuousTasks.set(task.id, {
|
|
1400
1414
|
runningTask: childProcess,
|
|
1401
1415
|
groupId,
|
|
@@ -1423,14 +1437,69 @@ class TaskOrchestrator {
|
|
|
1423
1437
|
}
|
|
1424
1438
|
// endregion Single Task
|
|
1425
1439
|
// region Readiness
|
|
1426
|
-
getReadyWhen(task) {
|
|
1427
|
-
return (0, ready_when_1.getReadyWhen)(task, this.projectGraph, this.projects, workspace_root_1.workspaceRoot);
|
|
1440
|
+
getReadyWhen(task, env) {
|
|
1441
|
+
return (0, ready_when_1.getReadyWhen)(task, this.projectGraph, this.projects, workspace_root_1.workspaceRoot, env);
|
|
1442
|
+
}
|
|
1443
|
+
// Only the process that runs a producer knows the env its probe reads
|
|
1444
|
+
getReadyWhenWait(task) {
|
|
1445
|
+
return (0, ready_when_1.getReadyWhenWait)(task, this.projectGraph, this.projects, workspace_root_1.workspaceRoot);
|
|
1446
|
+
}
|
|
1447
|
+
// An invalid readyWhen fails the task before it starts only when something
|
|
1448
|
+
// in this run waits for it; otherwise the task runs without a check
|
|
1449
|
+
getReadinessCheck(task, resolve) {
|
|
1450
|
+
try {
|
|
1451
|
+
const readyWhen = resolve();
|
|
1452
|
+
return {
|
|
1453
|
+
readyWhen,
|
|
1454
|
+
// A readyWhen resolves to no check when the server picks its port
|
|
1455
|
+
readyOnStart: readyWhen === null &&
|
|
1456
|
+
(0, ready_when_1.getReadyWhenConfig)(task, this.projectGraph) != null,
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
catch (e) {
|
|
1460
|
+
if (!(e instanceof ready_when_1.InvalidReadyWhenError) ||
|
|
1461
|
+
this.hasReadyWaiter(task.id)) {
|
|
1462
|
+
throw e;
|
|
1463
|
+
}
|
|
1464
|
+
return { readyWhen: null, uncheckedReason: e.message };
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
// Call it after the start: the TUI replaces the task's terminal when it
|
|
1468
|
+
// starts, dropping output appended before
|
|
1469
|
+
warnUncheckedReadiness(task, reason) {
|
|
1470
|
+
const message = `${reason} Nothing in this run waits for it to be ready, so it runs without a readiness check.`;
|
|
1471
|
+
if (this.tuiEnabled) {
|
|
1472
|
+
this.options.lifeCycle.appendTaskOutput(task.id, `\r\n${message}\r\n`, false);
|
|
1473
|
+
}
|
|
1474
|
+
else {
|
|
1475
|
+
console.warn(message);
|
|
1476
|
+
}
|
|
1428
1477
|
}
|
|
1429
1478
|
async waitForReadyDependencies(task) {
|
|
1430
1479
|
const producerIds = (0, ready_when_1.getReadyProducerIds)(task, this.fullTaskGraph);
|
|
1431
1480
|
for (const producerId of producerIds) {
|
|
1432
1481
|
const producer = this.fullTaskGraph.tasks[producerId];
|
|
1433
|
-
|
|
1482
|
+
let readyWhen;
|
|
1483
|
+
try {
|
|
1484
|
+
readyWhen = this.getReadyWhenWait(producer);
|
|
1485
|
+
}
|
|
1486
|
+
catch (e) {
|
|
1487
|
+
// An owner in another process runs it unchecked and marks its row
|
|
1488
|
+
// failed, or drops the row. Without a row, nothing will settle it.
|
|
1489
|
+
if (!(e instanceof ready_when_1.InvalidReadyWhenError) ||
|
|
1490
|
+
this.taskGraph.tasks[producerId]) {
|
|
1491
|
+
throw e;
|
|
1492
|
+
}
|
|
1493
|
+
this.onReadinessHold(producerId);
|
|
1494
|
+
const owned = await this.pollReadinessRow(producer, {
|
|
1495
|
+
timeout: ready_when_1.DEFAULT_READY_TIMEOUT,
|
|
1496
|
+
description: 'invalid',
|
|
1497
|
+
});
|
|
1498
|
+
if (!owned) {
|
|
1499
|
+
throw e;
|
|
1500
|
+
}
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1434
1503
|
if (!readyWhen) {
|
|
1435
1504
|
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
1436
1505
|
console.log(`Task "${producer.id}" declares no "readyWhen", so "${task.id}" runs once it has started.`);
|
|
@@ -1457,8 +1526,8 @@ class TaskOrchestrator {
|
|
|
1457
1526
|
}
|
|
1458
1527
|
}
|
|
1459
1528
|
// A row absent from the start means no Nx process this one can see owns the
|
|
1460
|
-
// producer, unless the caller already saw the owner: then it
|
|
1461
|
-
// that disappears mid-wait means the producer exited.
|
|
1529
|
+
// producer (resolves false), unless the caller already saw the owner: then it
|
|
1530
|
+
// exited. A row that disappears mid-wait means the producer exited.
|
|
1462
1531
|
async pollReadinessRow(producer, readyWhen, signal, ownerObserved = false) {
|
|
1463
1532
|
const deadline = Date.now() + readyWhen.timeout;
|
|
1464
1533
|
let lastStatus = null;
|
|
@@ -1474,14 +1543,14 @@ class TaskOrchestrator {
|
|
|
1474
1543
|
if (lastStatus !== null || ownerObserved) {
|
|
1475
1544
|
throw (0, ready_when_1.notReadyError)(producer.id, 'exited');
|
|
1476
1545
|
}
|
|
1477
|
-
return;
|
|
1546
|
+
return false;
|
|
1478
1547
|
}
|
|
1479
1548
|
if (status !== lastStatus) {
|
|
1480
1549
|
lastStatus = status;
|
|
1481
1550
|
this.options.lifeCycle.setTaskReadiness?.(producer.id, status);
|
|
1482
1551
|
}
|
|
1483
1552
|
if (status === 1 /* TaskReadiness.Ready */) {
|
|
1484
|
-
return;
|
|
1553
|
+
return true;
|
|
1485
1554
|
}
|
|
1486
1555
|
if (status === 2 /* TaskReadiness.Failed */) {
|
|
1487
1556
|
throw new ready_when_1.ProducerFailedError(producer.id);
|
|
@@ -1552,10 +1621,12 @@ class TaskOrchestrator {
|
|
|
1552
1621
|
await this.complete([{ task, status: 'skipped' }], groupId);
|
|
1553
1622
|
}
|
|
1554
1623
|
}
|
|
1555
|
-
// The probe's verdict stands for local waiters even when the row for
|
|
1556
|
-
// other processes cannot be written
|
|
1557
1624
|
recordReadiness(task, status) {
|
|
1558
1625
|
this.options.lifeCycle.setTaskReadiness?.(task.id, status);
|
|
1626
|
+
this.publishReadiness(task, status);
|
|
1627
|
+
}
|
|
1628
|
+
// Only other processes read the row, so a failed write must not fail this one
|
|
1629
|
+
publishReadiness(task, status) {
|
|
1559
1630
|
try {
|
|
1560
1631
|
this.runningTasksService?.setTaskReadiness(task.id, status);
|
|
1561
1632
|
}
|
|
@@ -1860,8 +1931,12 @@ class TaskOrchestrator {
|
|
|
1860
1931
|
if (process.env.NX_NATIVE_COMMAND_RUNNER !== 'false') {
|
|
1861
1932
|
return true;
|
|
1862
1933
|
}
|
|
1863
|
-
// The log probe reads the captured output
|
|
1864
|
-
|
|
1934
|
+
// The log probe reads the captured output. Read from the config, because
|
|
1935
|
+
// the probe resolves against the env that depends on this
|
|
1936
|
+
const readyWhen = (0, ready_when_1.getReadyWhenConfig)(task, this.projectGraph);
|
|
1937
|
+
if (typeof readyWhen === 'object' &&
|
|
1938
|
+
readyWhen &&
|
|
1939
|
+
'logMatches' in readyWhen) {
|
|
1865
1940
|
return true;
|
|
1866
1941
|
}
|
|
1867
1942
|
// When TUI is enabled, we need to use pipe output capture to support
|