@nrwl/nx-cloud 13.3.0 → 13.5.1-beta.1
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/bin/nx-cloud.js +10 -3
- package/bin/nx-cloud.js.map +1 -1
- package/generators.json +12 -0
- package/lib/core/api/error-reporter.api.d.ts +6 -0
- package/lib/core/api/error-reporter.api.js +36 -0
- package/lib/core/api/error-reporter.api.js.map +1 -0
- package/lib/core/api/run-group.api.d.ts +2 -2
- package/lib/core/api/run-group.api.js +73 -1
- package/lib/core/api/run-group.api.js.map +1 -1
- package/lib/core/commands/clean-up-agents.js +3 -3
- package/lib/core/commands/clean-up-agents.js.map +1 -1
- package/lib/core/commands/record-output.d.ts +0 -15
- package/lib/core/commands/record-output.js +37 -57
- package/lib/core/commands/record-output.js.map +1 -1
- package/lib/core/commands/start-ci-run.js +27 -5
- package/lib/core/commands/start-ci-run.js.map +1 -1
- package/lib/core/commands/stop-all-agents.js +6 -3
- package/lib/core/commands/stop-all-agents.js.map +1 -1
- package/lib/core/commands/upload-and-show-run-details.d.ts +1 -0
- package/lib/core/commands/upload-and-show-run-details.js +65 -0
- package/lib/core/commands/upload-and-show-run-details.js.map +1 -0
- package/lib/core/error/print-cacheable-targets-error.d.ts +1 -0
- package/lib/core/error/print-cacheable-targets-error.js +15 -0
- package/lib/core/error/print-cacheable-targets-error.js.map +1 -0
- package/lib/core/error/print-invalid-runner-error.d.ts +1 -0
- package/lib/core/error/print-invalid-runner-error.js +17 -0
- package/lib/core/error/print-invalid-runner-error.js.map +1 -0
- package/lib/core/error/print-run-group-error.d.ts +1 -0
- package/lib/core/error/print-run-group-error.js +9 -5
- package/lib/core/error/print-run-group-error.js.map +1 -1
- package/lib/core/file-storage/file-storage.d.ts +11 -1
- package/lib/core/file-storage/file-storage.js +103 -21
- package/lib/core/file-storage/file-storage.js.map +1 -1
- package/lib/core/models/cloud-task-runner-options.d.ts +1 -1
- package/lib/core/models/distributed-agent/tasks-api-response.model.d.ts +6 -0
- package/lib/core/models/run-context.model.d.ts +89 -1
- package/lib/core/models/run-context.model.js +19 -0
- package/lib/core/models/run-context.model.js.map +1 -1
- package/lib/core/models/run-data.model.d.ts +1 -1
- package/lib/core/models/task-execution.model.d.ts +1 -0
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.d.ts +1 -7
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +93 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.d.ts +1 -2
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +320 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.d.ts +8 -2
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +133 -1
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.d.ts +7 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +168 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.js.map +1 -1
- package/lib/core/runners/cloud-enabled/id-generator.d.ts +1 -0
- package/lib/core/runners/cloud-enabled/id-generator.js +16 -0
- package/lib/core/runners/cloud-enabled/id-generator.js.map +1 -0
- package/lib/core/runners/distributed-agent/distributed-agent.api.d.ts +6 -3
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +93 -1
- package/lib/core/runners/distributed-agent/distributed-agent.api.js.map +1 -1
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +157 -1
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js.map +1 -1
- package/lib/core/runners/distributed-agent/execute-tasks.d.ts +10 -0
- package/lib/core/runners/distributed-agent/execute-tasks.js +114 -0
- package/lib/core/runners/distributed-agent/execute-tasks.js.map +1 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-nx-imperative-api.d.ts +9 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-nx-imperative-api.js +58 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-nx-imperative-api.js.map +1 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-run-many.d.ts +9 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-run-many.js +97 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-run-many.js.map +1 -0
- package/lib/core/runners/distributed-execution/distributed-execution.api.d.ts +2 -2
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +152 -1
- package/lib/core/runners/distributed-execution/distributed-execution.api.js.map +1 -1
- package/lib/core/runners/distributed-execution/distributed-execution.runner.d.ts +0 -11
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +118 -1
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js.map +1 -1
- package/lib/core/runners/distributed-execution/process-task.d.ts +7 -0
- package/lib/core/runners/distributed-execution/process-task.js +45 -0
- package/lib/core/runners/distributed-execution/process-task.js.map +1 -0
- package/lib/core/runners/distributed-execution/process-tasks.d.ts +7 -0
- package/lib/core/runners/distributed-execution/process-tasks.js +67 -0
- package/lib/core/runners/distributed-execution/process-tasks.js.map +1 -0
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.d.ts +2 -0
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js +37 -0
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js.map +1 -0
- package/lib/core/runners/distributed-execution/task-graph-creator.d.ts +17 -0
- package/lib/core/runners/distributed-execution/task-graph-creator.js +100 -0
- package/lib/core/runners/distributed-execution/task-graph-creator.js.map +1 -0
- package/lib/core/terminal-output/end-of-run-message.d.ts +2 -1
- package/lib/core/terminal-output/end-of-run-message.js +18 -10
- package/lib/core/terminal-output/end-of-run-message.js.map +1 -1
- package/lib/core/terminal-output/read-task-terminal-output.d.ts +2 -0
- package/lib/core/terminal-output/read-task-terminal-output.js +60 -0
- package/lib/core/terminal-output/read-task-terminal-output.js.map +1 -0
- package/lib/daemon/process-run-end.d.ts +3 -0
- package/lib/daemon/process-run-end.js +66 -0
- package/lib/daemon/process-run-end.js.map +1 -0
- package/lib/generators/init/init.d.ts +1 -2
- package/lib/generators/init/init.js +33 -56
- package/lib/generators/init/init.js.map +1 -1
- package/lib/generators/init/schema.json +5 -0
- package/lib/nx-cloud-tasks-runner.js +83 -25
- package/lib/nx-cloud-tasks-runner.js.map +1 -1
- package/lib/utilities/axios.d.ts +2 -1
- package/lib/utilities/axios.js +26 -12
- package/lib/utilities/axios.js.map +1 -1
- package/lib/utilities/create-unchanged-value-timeout.d.ts +4 -0
- package/lib/utilities/{create-no-new-messages-timeout.js → create-unchanged-value-timeout.js} +6 -7
- package/lib/utilities/create-unchanged-value-timeout.js.map +1 -0
- package/lib/utilities/distributed-task-execution-detection.d.ts +2 -0
- package/lib/utilities/distributed-task-execution-detection.js +36 -0
- package/lib/utilities/distributed-task-execution-detection.js.map +1 -0
- package/lib/utilities/dte-artifact-storage.d.ts +7 -0
- package/lib/utilities/dte-artifact-storage.js +43 -0
- package/lib/utilities/dte-artifact-storage.js.map +1 -0
- package/lib/utilities/environment.d.ts +11 -7
- package/lib/utilities/environment.js +97 -33
- package/lib/utilities/environment.js.map +1 -1
- package/lib/utilities/is-ci.d.ts +1 -0
- package/lib/utilities/is-ci.js +21 -0
- package/lib/utilities/is-ci.js.map +1 -0
- package/lib/utilities/metric-logger.js +2 -2
- package/lib/utilities/metric-logger.js.map +1 -1
- package/lib/utilities/nx-imports.js +54 -33
- package/lib/utilities/nx-imports.js.map +1 -1
- package/lib/utilities/print-message.js +40 -11
- package/lib/utilities/print-message.js.map +1 -1
- package/lib/utilities/serializer-overrides.d.ts +3 -0
- package/lib/utilities/serializer-overrides.js +44 -0
- package/lib/utilities/serializer-overrides.js.map +1 -0
- package/package.json +7 -6
- package/project.json +37 -0
- package/tsconfig.lib.json +1 -1
- package/tsconfig.spec.json +2 -1
- package/collection.json +0 -22
- package/lib/utilities/create-no-new-messages-timeout.d.ts +0 -1
- package/lib/utilities/create-no-new-messages-timeout.js.map +0 -1
|
@@ -9,30 +9,82 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const from_1 = require("rxjs/internal/observable/from");
|
|
13
|
-
const switchMap_1 = require("rxjs/internal/operators/switchMap");
|
|
14
12
|
const environment_1 = require("./utilities/environment");
|
|
15
13
|
const axios_1 = require("./utilities/axios");
|
|
16
14
|
const cloud_enabled_runner_1 = require("./core/runners/cloud-enabled/cloud-enabled.runner");
|
|
17
|
-
const
|
|
15
|
+
const distributed_task_execution_detection_1 = require("./utilities/distributed-task-execution-detection");
|
|
16
|
+
const { tasksRunner, output, runnerReturnsPromise, } = require('./utilities/nx-imports');
|
|
18
17
|
const nxCloudTasksRunner = (tasks, options, context) => {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const nxArgs = context.nxArgs;
|
|
19
|
+
const noAccessTokenDefined = !environment_1.ACCESS_TOKEN && !options.accessToken;
|
|
20
|
+
const noCloud = nxArgs['cloud'] === false || options.skipNxCache;
|
|
21
|
+
if (options.skipNxCache) {
|
|
22
|
+
output.warn({
|
|
23
|
+
title: '--skip-nx-cache disables the connection to Nx Cloud for the current run.',
|
|
24
|
+
bodyLines: [
|
|
25
|
+
'The remote cache will not be read from or written to during this run.',
|
|
26
|
+
],
|
|
27
|
+
});
|
|
21
28
|
}
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
29
|
+
if (noAccessTokenDefined || noCloud) {
|
|
30
|
+
return tasksRunner(tasks, options, context);
|
|
24
31
|
}
|
|
25
|
-
if (environment_1.
|
|
32
|
+
if ((0, environment_1.nxInvokedByRunner)()) {
|
|
33
|
+
if (anyCacheableTargets(tasks, options)) {
|
|
34
|
+
return (0, cloud_enabled_runner_1.cloudEnabledTasksRunner)(tasks, options, context, true);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return tasksRunner(tasks, options, context);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if ((0, environment_1.agentRunningInDistributedExecution)(process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID)) {
|
|
26
41
|
verifyAllOperationsAreCacheableOnAgent(tasks, options);
|
|
27
42
|
}
|
|
28
|
-
// distributed execution main job
|
|
29
|
-
if (
|
|
30
|
-
!environment_1.
|
|
43
|
+
// distributed execution, main job
|
|
44
|
+
if ((0, distributed_task_execution_detection_1.isDistributedExecutionEnabled)(nxArgs['dte']) &&
|
|
45
|
+
!(0, environment_1.agentRunningInDistributedExecution)(process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID)) {
|
|
31
46
|
verifyAllOperationsAreCacheableOnMainJob(tasks, options);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
if (runnerReturnsPromise) {
|
|
48
|
+
return dtePromiseVersion(tasks, options, context);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return dteLegacyObservableVersion(tasks, options, context);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// This disables using Cloud for all inner nx invocations, so it won't create an extra run.
|
|
55
|
+
process.env.NX_INVOKED_BY_RUNNER = 'true';
|
|
56
|
+
return (0, cloud_enabled_runner_1.cloudEnabledTasksRunner)(tasks, options, context);
|
|
57
|
+
};
|
|
58
|
+
function dteLegacyObservableVersion(tasks, options, context) {
|
|
59
|
+
const { from } = require('rxjs/internal/observable/from');
|
|
60
|
+
const { switchMap } = require('rxjs/internal/operators/switchMap');
|
|
61
|
+
return from(verifyNxCloudWorkspaceEnabled(options)).pipe(switchMap((res) => {
|
|
62
|
+
if (res.data.enabled) {
|
|
63
|
+
return require('./core/runners/distributed-execution/distributed-execution.runner').nxCloudDistributedTasksRunner(tasks, options, context);
|
|
64
|
+
}
|
|
65
|
+
output.warn({
|
|
66
|
+
title: 'Nx Cloud: Workspace Disabled',
|
|
67
|
+
bodyLines: [
|
|
68
|
+
'This run and following runs will not use distributed task execution until',
|
|
69
|
+
'the outstanding balance is paid or additional coupons are added for this',
|
|
70
|
+
'workspace. If you believe you are receiving this message in error, please',
|
|
71
|
+
'contact support at cloud-support@nrwl.io.',
|
|
72
|
+
'',
|
|
73
|
+
'Execution will now continue using this machine only.',
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
// This disables using Cloud for all inner nx invocations, so it won't create an extra run.
|
|
77
|
+
process.env.NX_INVOKED_BY_RUNNER = 'true';
|
|
78
|
+
return (0, cloud_enabled_runner_1.cloudEnabledTasksRunner)(tasks, options, context);
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
function dtePromiseVersion(tasks, options, context) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const isEnabled = yield verifyNxCloudWorkspaceEnabled(options);
|
|
84
|
+
if (isEnabled.data.enabled) {
|
|
85
|
+
return require('./core/runners/distributed-execution/distributed-execution.runner').nxCloudDistributedTasksRunner(tasks, options, context);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
36
88
|
output.warn({
|
|
37
89
|
title: 'Nx Cloud: Workspace Disabled',
|
|
38
90
|
bodyLines: [
|
|
@@ -45,23 +97,29 @@ const nxCloudTasksRunner = (tasks, options, context) => {
|
|
|
45
97
|
],
|
|
46
98
|
});
|
|
47
99
|
// This disables using Cloud for all inner nx invocations, so it won't create an extra run.
|
|
48
|
-
process.env.
|
|
100
|
+
process.env.NX_INVOKED_BY_RUNNER = 'true';
|
|
49
101
|
return (0, cloud_enabled_runner_1.cloudEnabledTasksRunner)(tasks, options, context);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
process.env.NX_CLOUD = 'false';
|
|
54
|
-
return (0, cloud_enabled_runner_1.cloudEnabledTasksRunner)(tasks, options, context);
|
|
55
|
-
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
56
105
|
function verifyNxCloudWorkspaceEnabled(options) {
|
|
57
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
107
|
const axiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
59
108
|
return yield (0, axios_1.axiosMultipleTries)(() => axiosInstance.get('/nx-cloud/executions/workspace-status'));
|
|
60
109
|
});
|
|
61
110
|
}
|
|
111
|
+
function anyCacheableTargets(tasks, options) {
|
|
112
|
+
const cacheableTargets = options.cacheableOperations || [];
|
|
113
|
+
for (const task of tasks) {
|
|
114
|
+
if (cacheableTargets.indexOf(task.target.target) > -1) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
62
120
|
function verifyAllOperationsAreCacheableOnMainJob(tasks, options) {
|
|
63
121
|
const cacheableTargets = options.cacheableOperations || [];
|
|
64
|
-
|
|
122
|
+
for (const task of tasks) {
|
|
65
123
|
if (cacheableTargets.indexOf(task.target.target) === -1) {
|
|
66
124
|
output.error({
|
|
67
125
|
title: `Distributed task execution only works for cacheable targets`,
|
|
@@ -74,7 +132,7 @@ function verifyAllOperationsAreCacheableOnMainJob(tasks, options) {
|
|
|
74
132
|
});
|
|
75
133
|
process.exit(1);
|
|
76
134
|
}
|
|
77
|
-
}
|
|
135
|
+
}
|
|
78
136
|
}
|
|
79
137
|
function verifyAllOperationsAreCacheableOnAgent(tasks, options) {
|
|
80
138
|
const cacheableTargets = options.cacheableOperations || [];
|
|
@@ -85,7 +143,7 @@ function verifyAllOperationsAreCacheableOnAgent(tasks, options) {
|
|
|
85
143
|
bodyLines: [
|
|
86
144
|
`Target ${task.target.project}:${task.target.target} cannot be executed.`,
|
|
87
145
|
`To be able to replay the output of the target, distributed task execution only supports cacheable targets.`,
|
|
88
|
-
`You can still invoke "nx ${task.target.target} ${task.target.project}" from within a cacheable target when using "
|
|
146
|
+
`You can still invoke "nx ${task.target.target} ${task.target.project}" from within a cacheable target when using "nx:run-commands".`,
|
|
89
147
|
],
|
|
90
148
|
});
|
|
91
149
|
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-cloud-tasks-runner.js","sourceRoot":"","sources":["../../../../../libs/nx-packages/nx-cloud/lib/nx-cloud-tasks-runner.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"nx-cloud-tasks-runner.js","sourceRoot":"","sources":["../../../../../libs/nx-packages/nx-cloud/lib/nx-cloud-tasks-runner.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,yDAKiC;AACjC,6CAA+E;AAC/E,4FAA4F;AAE5F,2GAAiG;AAEjG,MAAM,EACJ,WAAW,EACX,MAAM,EACN,oBAAoB,GACrB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAEtC,MAAM,kBAAkB,GAAQ,CAC9B,KAAa,EACb,OAA+B,EAC/B,OAAY,EACP,EAAE;IACP,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE9B,MAAM,oBAAoB,GAAG,CAAC,0BAAY,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACnE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;IAEjE,IAAI,OAAO,CAAC,WAAW,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EACH,0EAA0E;YAC5E,SAAS,EAAE;gBACT,uEAAuE;aACxE;SACF,CAAC,CAAC;KACJ;IAED,IAAI,oBAAoB,IAAI,OAAO,EAAE;QACnC,OAAO,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAQ,CAAC;KACpD;IAED,IAAI,IAAA,+BAAiB,GAAE,EAAE;QACvB,IAAI,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;YACvC,OAAO,IAAA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AAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;YACvD,MAAM,CAAC,KAAK,CAAC;gBACX,KAAK,EAAE,6DAA6D;gBACpE,SAAS,EAAE;oBACT,UAAU,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,sBAAsB;oBACzE,4GAA4G;oBAC5G,4BAA4B,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,gEAAgE;iBACtI;aACF,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,mEAAqD,CAAC,CAAC;SACrE;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
|
package/lib/utilities/axios.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export declare class AxiosException {
|
|
|
6
6
|
constructor(type: 'timeout' | 'failure', message: string, axiosException: any);
|
|
7
7
|
}
|
|
8
8
|
export declare function createApiAxiosInstance(options: CloudTaskRunnerOptions): any;
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function printDuration(description: string, callback: Function): Promise<any>;
|
|
10
|
+
export declare function axiosMultipleTries(axiosCallCreator: () => Promise<any>, retriesLeft?: number): any;
|
package/lib/utilities/axios.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.axiosMultipleTries = exports.createApiAxiosInstance = exports.AxiosException = void 0;
|
|
12
|
+
exports.axiosMultipleTries = exports.printDuration = exports.createApiAxiosInstance = exports.AxiosException = void 0;
|
|
13
13
|
const environment_1 = require("./environment");
|
|
14
14
|
const waiter_1 = require("./waiter");
|
|
15
15
|
const { output } = require('./nx-imports');
|
|
@@ -23,19 +23,31 @@ class AxiosException {
|
|
|
23
23
|
}
|
|
24
24
|
exports.AxiosException = AxiosException;
|
|
25
25
|
function createApiAxiosInstance(options) {
|
|
26
|
-
const baseUrl = options.url || 'https://
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
29
|
-
throw new Error(`Unable to authenticate
|
|
26
|
+
const baseUrl = options.url || 'https://cloud.nx.app';
|
|
27
|
+
const accessToken = environment_1.ACCESS_TOKEN ? environment_1.ACCESS_TOKEN : options.accessToken;
|
|
28
|
+
if (!accessToken) {
|
|
29
|
+
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
|
|
30
30
|
}
|
|
31
31
|
return axios.create({
|
|
32
32
|
baseURL: baseUrl,
|
|
33
33
|
timeout: environment_1.NX_CLOUD_NO_TIMEOUTS ? environment_1.UNLIMITED_TIMEOUT : 10000,
|
|
34
|
-
headers: { authorization:
|
|
34
|
+
headers: { authorization: accessToken },
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
exports.createApiAxiosInstance = createApiAxiosInstance;
|
|
38
|
-
function
|
|
38
|
+
function printDuration(description, callback) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const b = new Date();
|
|
41
|
+
const res = yield callback();
|
|
42
|
+
const a = new Date();
|
|
43
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
44
|
+
console.log(`${description}: ${a.getTime() - b.getTime()}`);
|
|
45
|
+
}
|
|
46
|
+
return res;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.printDuration = printDuration;
|
|
50
|
+
function axiosMultipleTries(axiosCallCreator, retriesLeft = environment_1.NUMBER_OF_AXIOS_RETRIES) {
|
|
39
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
52
|
try {
|
|
41
53
|
return yield axiosCallCreator();
|
|
@@ -44,9 +56,9 @@ function axiosMultipleTries(axiosCallCreator, attemptsLeft = environment_1.NUMBE
|
|
|
44
56
|
const code = e.code || (e.response && e.response.status);
|
|
45
57
|
// Do not retry if we receive an unauthorized or forbidden response
|
|
46
58
|
if (code === 401 || code === 403) {
|
|
47
|
-
|
|
59
|
+
retriesLeft = 0;
|
|
48
60
|
}
|
|
49
|
-
if (
|
|
61
|
+
if (retriesLeft === 0) {
|
|
50
62
|
let message = e.response
|
|
51
63
|
? e.response.data.message
|
|
52
64
|
? e.response.data.message
|
|
@@ -58,13 +70,15 @@ function axiosMultipleTries(axiosCallCreator, attemptsLeft = environment_1.NUMBE
|
|
|
58
70
|
throw new AxiosException('failure', `Error when connecting to Nx Cloud. Code: ${code}. Error: ${message}.`, e);
|
|
59
71
|
}
|
|
60
72
|
else {
|
|
73
|
+
const retryAfter = 1000 +
|
|
74
|
+
(environment_1.NUMBER_OF_AXIOS_RETRIES + 1 - retriesLeft) * 4000 * Math.random();
|
|
61
75
|
if (environment_1.VERBOSE_LOGGING) {
|
|
62
76
|
output.note({
|
|
63
|
-
title: `Received ${code}. Retrying in
|
|
77
|
+
title: `Received ${code}. Retrying in ${retryAfter}ms.`,
|
|
64
78
|
});
|
|
65
79
|
}
|
|
66
|
-
yield (0, waiter_1.wait)(
|
|
67
|
-
return axiosMultipleTries(axiosCallCreator,
|
|
80
|
+
yield (0, waiter_1.wait)(retryAfter);
|
|
81
|
+
return axiosMultipleTries(axiosCallCreator, retriesLeft - 1);
|
|
68
82
|
}
|
|
69
83
|
}
|
|
70
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/axios.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAMuB;AACvB,qCAAgC;AAGhC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B,MAAa,cAAc;IACzB,YACkB,IAA2B,EAC3B,OAAe,EACf,cAAmB;QAFnB,SAAI,GAAJ,IAAI,CAAuB;QAC3B,YAAO,GAAP,OAAO,CAAQ;QACf,mBAAc,GAAd,cAAc,CAAK;IAClC,CAAC;CACL;AAND,wCAMC;AAED,SAAgB,sBAAsB,CAAC,OAA+B;IACpE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/axios.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAMuB;AACvB,qCAAgC;AAGhC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B,MAAa,cAAc;IACzB,YACkB,IAA2B,EAC3B,OAAe,EACf,cAAmB;QAFnB,SAAI,GAAJ,IAAI,CAAuB;QAC3B,YAAO,GAAP,OAAO,CAAQ;QACf,mBAAc,GAAd,cAAc,CAAK;IAClC,CAAC;CACL;AAND,wCAMC;AAED,SAAgB,sBAAsB,CAAC,OAA+B;IACpE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,IAAI,sBAAsB,CAAC;IACtD,MAAM,WAAW,GAAG,0BAAY,CAAC,CAAC,CAAC,0BAAY,CAAC,CAAC,CAAC,OAAO,CAAC,WAAY,CAAC;IAEvE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,6GAA6G,CAC9G,CAAC;KACH;IAED,OAAO,KAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,kCAAoB,CAAC,CAAC,CAAC,+BAAiB,CAAC,CAAC,CAAC,KAAK;QACzD,OAAO,EAAE,EAAE,aAAa,EAAE,WAAW,EAAE;KACxC,CAAC,CAAC;AACL,CAAC;AAfD,wDAeC;AAED,SAAsB,aAAa,CAAC,WAAmB,EAAE,QAAkB;;QACzE,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAA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AC,GAAG,WAAW,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;gBACrE,IAAI,6BAAe,EAAE;oBACnB,MAAM,CAAC,IAAI,CAAC;wBACV,KAAK,EAAE,YAAY,IAAI,iBAAiB,UAAU,KAAK;qBACxD,CAAC,CAAC;iBACJ;gBACD,MAAM,IAAA,aAAI,EAAC,UAAU,CAAC,CAAC;gBACvB,OAAO,kBAAkB,CAAC,gBAAgB,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;aAC9D;SACF;IACH,CAAC;CAAA;AAzCD,gDAyCC"}
|
package/lib/utilities/{create-no-new-messages-timeout.js → create-unchanged-value-timeout.js}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const environment_1 = require("./environment");
|
|
3
|
+
exports.createUnchangedValueTimeout = void 0;
|
|
5
4
|
const { output } = require('./nx-imports');
|
|
6
|
-
function
|
|
5
|
+
function createUnchangedValueTimeout(options) {
|
|
7
6
|
let value = new Object();
|
|
8
7
|
let valueIsSetAt;
|
|
9
8
|
return (newValue) => {
|
|
@@ -12,14 +11,14 @@ function createNoNewMessagesTimeout() {
|
|
|
12
11
|
valueIsSetAt = new Date();
|
|
13
12
|
}
|
|
14
13
|
else {
|
|
15
|
-
if (new Date().getTime() - valueIsSetAt.getTime() >
|
|
14
|
+
if (new Date().getTime() - valueIsSetAt.getTime() > options.timeout) {
|
|
16
15
|
output.error({
|
|
17
|
-
title:
|
|
16
|
+
title: options.title,
|
|
18
17
|
});
|
|
19
18
|
process.exit(1);
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
|
-
exports.
|
|
25
|
-
//# sourceMappingURL=create-
|
|
23
|
+
exports.createUnchangedValueTimeout = createUnchangedValueTimeout;
|
|
24
|
+
//# sourceMappingURL=create-unchanged-value-timeout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-unchanged-value-timeout.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/create-unchanged-value-timeout.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE3C,SAAgB,2BAA2B,CAAC,OAG3C;IACC,IAAI,KAAK,GAAG,IAAI,MAAM,EAAE,CAAC;IACzB,IAAI,YAAY,CAAC;IACjB,OAAO,CAAC,QAAQ,EAAE,EAAE;QAClB,IAAI,KAAK,KAAK,QAAQ,EAAE;YACtB,KAAK,GAAG,QAAQ,CAAC;YACjB,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC;SAC3B;aAAM;YACL,IAAI,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE;gBACnE,MAAM,CAAC,KAAK,CAAC;oBACX,KAAK,EAAE,OAAO,CAAC,KAAK;iBACrB,CAAC,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;SACF;IACH,CAAC,CAAC;AACJ,CAAC;AAnBD,kEAmBC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDistributedExecutionEnabled = exports.storeDteMarker = void 0;
|
|
4
|
+
const fs_extra_1 = require("fs-extra");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const nxCacheDirectory = process.env.NX_CACHE_DIRECTORY
|
|
8
|
+
? [process.env['NX_CACHE_DIRECTORY']]
|
|
9
|
+
: ['node_modules', '.cache', 'nx'];
|
|
10
|
+
const dir = (0, path_1.join)(process.cwd(), ...nxCacheDirectory);
|
|
11
|
+
const dteMarker = (0, path_1.join)(dir, 'NX_CLOUD_DISTRIBUTED_EXECUTION');
|
|
12
|
+
function storeDteMarker() {
|
|
13
|
+
(0, fs_extra_1.ensureDirSync)(dir);
|
|
14
|
+
(0, fs_extra_1.writeFileSync)(dteMarker, 'true');
|
|
15
|
+
}
|
|
16
|
+
exports.storeDteMarker = storeDteMarker;
|
|
17
|
+
function isDistributedExecutionEnabled(explicitOption) {
|
|
18
|
+
if (explicitOption === true)
|
|
19
|
+
return true;
|
|
20
|
+
if (explicitOption === false)
|
|
21
|
+
return false;
|
|
22
|
+
const envVar = process.env.NX_CLOUD_DISTRIBUTED_EXECUTION;
|
|
23
|
+
if (envVar === 'false' || envVar === 'FALSE' || envVar === '0')
|
|
24
|
+
return false;
|
|
25
|
+
if (envVar === 'true' || envVar === 'TRUE' || envVar === '1')
|
|
26
|
+
return true;
|
|
27
|
+
try {
|
|
28
|
+
(0, fs_1.readFileSync)(dteMarker);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.isDistributedExecutionEnabled = isDistributedExecutionEnabled;
|
|
36
|
+
//# sourceMappingURL=distributed-task-execution-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributed-task-execution-detection.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/distributed-task-execution-detection.ts"],"names":[],"mappings":";;;AAAA,uCAAwD;AACxD,+BAA4B;AAC5B,2BAAkC;AAElC,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB;IACrD,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC,cAAc,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACrC,MAAM,GAAG,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,gBAAgB,CAAC,CAAC;AACrD,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,GAAG,EAAE,gCAAgC,CAAC,CAAC;AAE9D,SAAgB,cAAc;IAC5B,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAC;IACnB,IAAA,wBAAa,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACnC,CAAC;AAHD,wCAGC;AAED,SAAgB,6BAA6B,CAC3C,cAAwC;IAExC,IAAI,cAAc,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,cAAc,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAE3C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC;IAC1D,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IAC7E,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAE1E,IAAI;QACF,IAAA,iBAAY,EAAC,SAAS,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAhBD,sEAgBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FileStorage } from '../core/file-storage/file-storage';
|
|
2
|
+
export declare class DteArtifactStorage {
|
|
3
|
+
private readonly fileStorage;
|
|
4
|
+
private readonly cacheDirectory;
|
|
5
|
+
constructor(fileStorage: FileStorage, cacheDirectory: string);
|
|
6
|
+
retrieveAndExtract(hash: string, url: string): Promise<string>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DteArtifactStorage = void 0;
|
|
13
|
+
const environment_1 = require("./environment");
|
|
14
|
+
const fs_extra_1 = require("fs-extra");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
const { output, workspaceRoot } = require('./nx-imports');
|
|
17
|
+
class DteArtifactStorage {
|
|
18
|
+
constructor(fileStorage, cacheDirectory) {
|
|
19
|
+
this.fileStorage = fileStorage;
|
|
20
|
+
this.cacheDirectory = cacheDirectory;
|
|
21
|
+
(0, fs_extra_1.mkdirSync)(cacheDirectory, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
retrieveAndExtract(hash, url) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
26
|
+
output.note({
|
|
27
|
+
title: `Retrieving artifacts from ${url}`,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
yield this.fileStorage.retrieve(hash, url, this.cacheDirectory);
|
|
31
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
32
|
+
output.note({
|
|
33
|
+
title: `Extracting artifacts`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const outputs = (0, path_1.join)(this.cacheDirectory, hash, 'outputs');
|
|
37
|
+
yield (0, fs_extra_1.copy)(outputs, workspaceRoot);
|
|
38
|
+
return (yield (0, fs_extra_1.readFile)((0, path_1.join)(this.cacheDirectory, hash, 'terminalOutput'))).toString();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.DteArtifactStorage = DteArtifactStorage;
|
|
43
|
+
//# sourceMappingURL=dte-artifact-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dte-artifact-storage.js","sourceRoot":"","sources":["../../../../../../libs/nx-packages/nx-cloud/lib/utilities/dte-artifact-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+CAAgD;AAChD,uCAAqD;AACrD,+BAA4B;AAE5B,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE1D,MAAa,kBAAkB;IAC7B,YACmB,WAAwB,EACxB,cAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAQ;QAEvC,IAAA,oBAAS,EAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAEK,kBAAkB,CAAC,IAAY,EAAE,GAAW;;YAChD,IAAI,6BAAe,EAAE;gBACnB,MAAM,CAAC,IAAI,CAAC;oBACV,KAAK,EAAE,6BAA6B,GAAG,EAAE;iBAC1C,CAAC,CAAC;aACJ;YAED,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YAEhE,IAAI,6BAAe,EAAE;gBACnB,MAAM,CAAC,IAAI,CAAC;oBACV,KAAK,EAAE,sBAAsB;iBAC9B,CAAC,CAAC;aACJ;YACD,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;YAC3D,MAAM,IAAA,eAAI,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YACnC,OAAO,CACL,MAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAClE,CAAC,QAAQ,EAAE,CAAC;QACf,CAAC;KAAA;CACF;AA5BD,gDA4BC"}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { CloudTaskRunnerOptions } from '../core/models/cloud-task-runner-options';
|
|
2
2
|
import { MachineInfo } from '../core/models/machine-info.model';
|
|
3
|
+
export declare const NX_DEFAULT_CACHE_LOCATION = "./node_modules/.cache/nx";
|
|
3
4
|
export declare const UNLIMITED_TIMEOUT = 9999999;
|
|
4
|
-
export declare const NO_MESSAGES_TIMEOUT
|
|
5
|
+
export declare const NO_MESSAGES_TIMEOUT: number;
|
|
6
|
+
export declare const NO_COMPLETED_TASKS_TIMEOUT: number;
|
|
5
7
|
export declare const UNLIMITED_FILE_SIZE: number;
|
|
8
|
+
export declare const NX_CLOUD_UNLIMITED_OUTPUT: boolean;
|
|
6
9
|
export declare const DEFAULT_FILE_SIZE_LIMIT: number;
|
|
7
10
|
export declare const DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE = 166;
|
|
8
|
-
export declare const NX_NO_CLOUD: boolean;
|
|
9
|
-
export declare const NX_CLOUD_DISTRIBUTED_EXECUTION_ID: string | undefined;
|
|
10
|
-
export declare const AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION: boolean;
|
|
11
|
-
export declare const NX_CLOUD_DISTRIBUTED_EXECUTION: boolean;
|
|
12
|
-
export declare const NUMBER_OF_AXIOS_RETRIES: number;
|
|
13
11
|
export declare const NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: number | null;
|
|
14
12
|
export declare const NX_CLOUD_DISTRIBUTED_EXECUTION_STOP_AGENTS_ON_FAILURE: boolean;
|
|
15
13
|
export declare const NX_CLOUD_FORCE_METRICS: boolean;
|
|
14
|
+
export declare const NUMBER_OF_AXIOS_RETRIES: number;
|
|
16
15
|
export declare let ACCESS_TOKEN: any;
|
|
17
16
|
export declare let ENCRYPTION_KEY: any;
|
|
18
17
|
export declare let VERBOSE_LOGGING: any;
|
|
19
18
|
export declare let NX_CLOUD_NO_TIMEOUTS: any;
|
|
19
|
+
export declare function agentRunningInDistributedExecution(distributedExecutionId: string | undefined): boolean;
|
|
20
|
+
export declare function nxInvokedByRunner(): boolean;
|
|
20
21
|
export declare function extractGitSha(): string | undefined;
|
|
21
|
-
export declare function
|
|
22
|
+
export declare function getCIExecutionId(): string | null;
|
|
23
|
+
export declare function getCIExecutionEnv(): string;
|
|
24
|
+
export declare function getRunGroup(): string;
|
|
22
25
|
export declare function getBranch(): string | null;
|
|
23
26
|
export declare function getMachineInfo(options: CloudTaskRunnerOptions): MachineInfo;
|
|
24
27
|
export declare function parseCommand(): string;
|
|
28
|
+
export declare function getNxCacheDirectory(options: CloudTaskRunnerOptions): string;
|