@nrwl/nx-cloud 12.5.3 → 13.0.0-beta.11
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 +2 -2
- package/bin/nx-cloud.js.map +1 -1
- package/lib/core/api/run-group.api.js +59 -1
- package/lib/core/runners/cloud-enabled/{task-runner-life-cycle.d.ts → cloud-enabled-life-cycle.d.ts} +4 -3
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +120 -0
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js.map +1 -0
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +164 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +113 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +135 -1
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +73 -1
- package/lib/core/runners/distributed-agent/{distributed-agent.runner.d.ts → distributed-agent.impl.d.ts} +0 -0
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +233 -0
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js.map +1 -0
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +115 -1
- package/lib/core/runners/distributed-execution/distributed-execution.api.js.map +1 -1
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +270 -1
- package/lib/core/terminal-output/end-of-run-message.d.ts +2 -5
- package/lib/core/terminal-output/end-of-run-message.js +3 -40
- package/lib/core/terminal-output/end-of-run-message.js.map +1 -1
- package/lib/utilities/metric-logger.js +13 -8
- package/lib/utilities/metric-logger.js.map +1 -1
- package/package.json +1 -1
- package/lib/core/runners/cloud-enabled/task-runner-life-cycle.js +0 -1
- package/lib/core/runners/cloud-enabled/task-runner-life-cycle.js.map +0 -1
- package/lib/core/runners/distributed-agent/distributed-agent.runner.js +0 -1
- package/lib/core/runners/distributed-agent/distributed-agent.runner.js.map +0 -1
package/bin/nx-cloud.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const
|
|
4
|
+
const distributed_agent_impl_1 = require("../lib/core/runners/distributed-agent/distributed-agent.impl");
|
|
5
5
|
const start_ci_run_1 = require("../lib/core/commands/start-ci-run");
|
|
6
6
|
const stop_all_agents_1 = require("../lib/core/commands/stop-all-agents");
|
|
7
7
|
const clean_up_agents_1 = require("../lib/core/commands/clean-up-agents");
|
|
8
8
|
const command = process.argv[2];
|
|
9
9
|
if (command === 'start-agent') {
|
|
10
|
-
(0,
|
|
10
|
+
(0, distributed_agent_impl_1.startAgent)().catch((e) => {
|
|
11
11
|
console.error(e);
|
|
12
12
|
process.exit(1);
|
|
13
13
|
});
|
package/bin/nx-cloud.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-cloud.js","sourceRoot":"","sources":["../../../../../libs/nx-packages/nx-cloud/src/bin/nx-cloud.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"nx-cloud.js","sourceRoot":"","sources":["../../../../../libs/nx-packages/nx-cloud/src/bin/nx-cloud.ts"],"names":[],"mappings":";;;AAEA,yGAA0F;AAC1F,oEAA+D;AAC/D,0EAAqE;AACrE,0EAAqE;AAErE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhC,IAAI,OAAO,KAAK,aAAa,EAAE;IAC7B,IAAA,mCAAU,GAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACJ;KAAM,IAAI,OAAO,KAAK,iBAAiB,EAAE;IACxC,IAAA,+BAAa,GAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACJ;KAAM,IAAI,OAAO,KAAK,cAAc,EAAE;IACrC,IAAA,yBAAU,GAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACJ;KAAM,IAAI,OAAO,KAAK,iBAAiB,EAAE;IACxC,IAAA,+BAAa,GAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACJ;KAAM;IACL,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;CACtE"}
|
|
@@ -1 +1,59 @@
|
|
|
1
|
-
|
|
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.RunGroupApi = void 0;
|
|
13
|
+
const output_1 = require("@nrwl/workspace/src/utilities/output");
|
|
14
|
+
const axios_1 = require("../../utilities/axios");
|
|
15
|
+
const metric_logger_1 = require("../../utilities/metric-logger");
|
|
16
|
+
class RunGroupApi {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
19
|
+
}
|
|
20
|
+
createRunGroup(branch, runGroup) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
|
|
23
|
+
try {
|
|
24
|
+
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/create-run-group', {
|
|
25
|
+
branch: branch,
|
|
26
|
+
runGroup: runGroup,
|
|
27
|
+
}), 3);
|
|
28
|
+
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
recorder.recordMetric(metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
32
|
+
output_1.output.error({
|
|
33
|
+
title: e.message,
|
|
34
|
+
});
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
completeRunGroup(runGroup) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
|
|
42
|
+
try {
|
|
43
|
+
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
44
|
+
runGroup: runGroup,
|
|
45
|
+
}), 3);
|
|
46
|
+
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
recorder.recordMetric(metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
50
|
+
output_1.output.error({
|
|
51
|
+
title: e.message,
|
|
52
|
+
});
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.RunGroupApi = RunGroupApi;
|
|
59
|
+
//# sourceMappingURL=run-group.api.js.map
|
package/lib/core/runners/cloud-enabled/{task-runner-life-cycle.d.ts → cloud-enabled-life-cycle.d.ts}
RENAMED
|
@@ -2,20 +2,21 @@ import { Task } from '@nrwl/workspace/src/tasks-runner/tasks-runner';
|
|
|
2
2
|
import { RunContext } from '../../models/run-context.model';
|
|
3
3
|
import { TaskExecution } from '../../models/task-execution.model';
|
|
4
4
|
import { OutputObfuscator } from '../../terminal-output/output-obfuscator';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class CloudEnabledLifeCycle {
|
|
6
6
|
private readonly runContext;
|
|
7
7
|
private readonly cacheDirectory;
|
|
8
8
|
private readonly collectTerminalOutput;
|
|
9
9
|
private readonly cacheableOperations;
|
|
10
10
|
private readonly outputObfuscator;
|
|
11
|
+
private readonly tasks;
|
|
11
12
|
private static MAX_CHARACTERS_FAILED_TASK;
|
|
12
13
|
private static MAX_CHARACTERS_SUCCESSFUL_TASK;
|
|
13
14
|
private static MAX_CHARACTERS_CACHED_TASK;
|
|
14
|
-
|
|
15
|
-
constructor(runContext: RunContext, cacheDirectory: string | undefined, collectTerminalOutput: boolean, cacheableOperations: string[], outputObfuscator: OutputObfuscator);
|
|
15
|
+
constructor(runContext: RunContext, cacheDirectory: string | undefined, collectTerminalOutput: boolean, cacheableOperations: string[], outputObfuscator: OutputObfuscator, tasks: TaskExecution[]);
|
|
16
16
|
scheduleTask(task: Task): void;
|
|
17
17
|
startTask(task: Task): void;
|
|
18
18
|
endTask(task: Task, code: number): void;
|
|
19
|
+
endCommand(): void;
|
|
19
20
|
private getTerminalOutput;
|
|
20
21
|
private cleanUpHashDetails;
|
|
21
22
|
private readTerminalOutputFile;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudEnabledLifeCycle = void 0;
|
|
4
|
+
const utils_1 = require("@nrwl/workspace/src/tasks-runner/utils");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const app_root_1 = require("@nrwl/workspace/src/utils/app-root");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
class CloudEnabledLifeCycle {
|
|
10
|
+
constructor(runContext, cacheDirectory, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
|
|
11
|
+
this.runContext = runContext;
|
|
12
|
+
this.cacheDirectory = cacheDirectory;
|
|
13
|
+
this.collectTerminalOutput = collectTerminalOutput;
|
|
14
|
+
this.cacheableOperations = cacheableOperations;
|
|
15
|
+
this.outputObfuscator = outputObfuscator;
|
|
16
|
+
this.tasks = tasks;
|
|
17
|
+
}
|
|
18
|
+
scheduleTask(task) {
|
|
19
|
+
this.runContext.scheduledTasks.push(task);
|
|
20
|
+
}
|
|
21
|
+
startTask(task) {
|
|
22
|
+
const overrides = Object.assign({}, (task.overrides || {}));
|
|
23
|
+
if (task.target.configuration) {
|
|
24
|
+
overrides['configuration'] = task.target.configuration;
|
|
25
|
+
}
|
|
26
|
+
this.tasks.push({
|
|
27
|
+
taskId: task.id,
|
|
28
|
+
startTime: new Date().toISOString(),
|
|
29
|
+
target: task.target.target,
|
|
30
|
+
projectName: task.target.project,
|
|
31
|
+
hash: task.hash,
|
|
32
|
+
hashDetails: this.cleanUpHashDetails(task.hashDetails),
|
|
33
|
+
params: (0, utils_1.unparse)(overrides).join(' '),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
endTask(task, code) {
|
|
37
|
+
const startedTask = this.tasks.find((t) => t.taskId === task.id);
|
|
38
|
+
if (!startedTask) {
|
|
39
|
+
throw new Error(`Cannot find task ${task.id}`);
|
|
40
|
+
}
|
|
41
|
+
startedTask.endTime = new Date().toISOString();
|
|
42
|
+
startedTask.status = code;
|
|
43
|
+
startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
|
|
44
|
+
if (this.runContext.statuses[task.hash]) {
|
|
45
|
+
startedTask.cacheStatus = this.runContext.statuses[task.hash];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if (this.cacheableOperations.indexOf(task.target.target) > -1) {
|
|
49
|
+
startedTask.cacheStatus = 'local-cache-hit';
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
startedTask.cacheStatus = 'cache-miss';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (this.collectTerminalOutput) {
|
|
56
|
+
startedTask.terminalOutput = this.getTerminalOutput(task.hash, startedTask.cacheStatus, code);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
endCommand() { }
|
|
60
|
+
getTerminalOutput(hash, cacheStatus, code) {
|
|
61
|
+
let dir;
|
|
62
|
+
if (this.cacheDirectory) {
|
|
63
|
+
if (this.cacheDirectory.startsWith('./')) {
|
|
64
|
+
dir = (0, path_1.join)(app_root_1.appRootPath, this.cacheDirectory);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
dir = this.cacheDirectory;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
dir = (0, path_1.join)(app_root_1.appRootPath, 'node_modules', '.cache', 'nx');
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const taskOutput = this.readTerminalOutputFile(dir, hash);
|
|
75
|
+
const taskOutputSanitized = this.outputObfuscator.obfuscate(taskOutput);
|
|
76
|
+
const maxCharacters = cacheStatus === 'cache-miss'
|
|
77
|
+
? code === 0
|
|
78
|
+
? CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK
|
|
79
|
+
: CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK
|
|
80
|
+
: CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK;
|
|
81
|
+
return taskOutputSanitized.length > maxCharacters
|
|
82
|
+
? `TRUNCATED\n\n${taskOutputSanitized.slice(taskOutputSanitized.length - maxCharacters)}`
|
|
83
|
+
: taskOutputSanitized;
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
cleanUpHashDetails(hashDetails) {
|
|
90
|
+
const nodes = {};
|
|
91
|
+
Object.keys(hashDetails.nodes)
|
|
92
|
+
.filter((k) => !k.startsWith('npm:'))
|
|
93
|
+
.forEach((k) => {
|
|
94
|
+
nodes[k] = hashDetails.nodes[k];
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
nodes,
|
|
98
|
+
runtime: hashDetails.runtime,
|
|
99
|
+
implicitDeps: hashDetails.implicitDeps,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
readTerminalOutputFile(dir, hash) {
|
|
103
|
+
try {
|
|
104
|
+
return (0, fs_1.readFileSync)(path.join(dir, 'terminalOutputs', hash)).toString();
|
|
105
|
+
}
|
|
106
|
+
catch (_a) {
|
|
107
|
+
try {
|
|
108
|
+
return (0, fs_1.readFileSync)(path.join(dir, hash, 'terminalOutput')).toString();
|
|
109
|
+
}
|
|
110
|
+
catch (_b) {
|
|
111
|
+
return '';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.CloudEnabledLifeCycle = CloudEnabledLifeCycle;
|
|
117
|
+
CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK = 200000;
|
|
118
|
+
CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK = 20000;
|
|
119
|
+
CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK = 5000;
|
|
120
|
+
//# sourceMappingURL=cloud-enabled-life-cycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-enabled-life-cycle.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-packages/nx-cloud/src/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.ts"],"names":[],"mappings":";;;AACA,kEAAiE;AACjE,+BAA4B;AAC5B,iEAAiE;AACjE,2BAAkC;AAClC,6BAA6B;AAM7B,MAAa,qBAAqB;IAKhC,YACmB,UAAsB,EACtB,cAAkC,EAClC,qBAA8B,EAC9B,mBAA6B,EAC7B,gBAAkC,EAClC,KAAsB;QALtB,eAAU,GAAV,UAAU,CAAY;QACtB,mBAAc,GAAd,cAAc,CAAoB;QAClC,0BAAqB,GAArB,qBAAqB,CAAS;QAC9B,wBAAmB,GAAnB,mBAAmB,CAAU;QAC7B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,UAAK,GAAL,KAAK,CAAiB;IACtC,CAAC;IAEJ,YAAY,CAAC,IAAU;QACrB,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,SAAS,CAAC,IAAU;QAClB,MAAM,SAAS,GAAG,kBAAK,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAS,CAAC;QACvD,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;YAC7B,SAAS,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;SACxD;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAChC,IAAI,EAAE,IAAI,CAAC,IAAK;YAChB,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAE,IAAY,CAAC,WAAW,CAAC;YAC/D,MAAM,EAAE,IAAA,eAAO,EAAC,SAAS,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ACpC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACb,KAAK,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QACL,OAAO;YACL,KAAK;YACL,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,YAAY,EAAE,WAAW,CAAC,YAAY;SACvC,CAAC;IACJ,CAAC;IAEO,sBAAsB,CAAC,GAAW,EAAE,IAAY;QACtD,IAAI;YACF,OAAO,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;SACzE;QAAC,WAAM;YACN,IAAI;gBACF,OAAO,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;aACxE;YAAC,WAAM;gBACN,OAAO,EAAE,CAAC;aACX;SACF;IACH,CAAC;;AAzHH,sDA0HC;AAzHgB,gDAA0B,GAAG,MAAM,CAAC;AACpC,oDAA8B,GAAG,KAAK,CAAC;AACvC,gDAA0B,GAAG,IAAI,CAAC"}
|
|
@@ -1 +1,164 @@
|
|
|
1
|
-
const a0_0x5ac1=['CloudRunApi','0x3c','E2EEncryption','0x28','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','0x29','0x1a','forEach','NUMBER_OF_TRIES','0xe','subscribe','0x30','0x33','0x27','0x23','0x47','printMessages','0x26','0x1e','./node_modules/.cache/nx','filter','next','0x3a','0x2a','path','0x45','0xb','../../../utilities/environment','__esModule','0xa','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','0x10','0x19','0xc','OutputObfuscator','0x38','0x20','obfuscate','0x25','scan','encryptionKey','0x2','0x3b','tasksRunnerV2','0x15','0x7','toISOString','0x3e','requests','endRun','0x1','EndOfRunMessage','Executed\x20tasks\x20with\x20hashes:\x20','ENCRYPTION_KEY','assign','stringify','0x32','map','0x17','getBranch','0x18','terminalOutput','tasks-hashes','shift','getMachineInfo','MessageReporter','0x31','0x2f','throw','tasks','../../../utilities/metric-logger','0x46','0x8','hash','./cloud-run.api','0x1b','extractGitSha','startRun','note','taskId','parseCommand','0x22','then','0x11','0x1c','0x43','done','Agent\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run','FileStorage','0x42','0x5','../../terminal-output/end-of-run-message','Completed\x20tasks','0x1d','value','0x3d','use\x20strict','0x2b','AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION','0x41','0x12','../../terminal-output/output-obfuscator','0x24','TaskRunnerLifeCycle','0x2e','all','...','./task-runner-life-cycle','0x21','output','0x13','cacheableOperations','slice','exit','error','0xd','0xf','0x3','@nrwl/workspace/src/utilities/output','0x9','Subject','cacheDirectory','cloudEnabledTasksRunner','../../terminal-output/message-reporter','0x37','0x14','__awaiter'];(function(_0x4f6d1b,_0x5ac180){const _0x58a419=function(_0x360218){while(--_0x360218){_0x4f6d1b['push'](_0x4f6d1b['shift']());}};_0x58a419(++_0x5ac180);}(a0_0x5ac1,0x1b1));const a0_0x58a4=function(_0x4f6d1b,_0x5ac180){_0x4f6d1b=_0x4f6d1b-0x0;let _0x58a419=a0_0x5ac1[_0x4f6d1b];return _0x58a419;};const a0_0x35c2=[a0_0x58a4('0x67'),a0_0x58a4('0x7c'),a0_0x58a4('0x7b'),a0_0x58a4('0x4b'),a0_0x58a4('0x2a'),a0_0x58a4('0x2'),a0_0x58a4('0x76'),'defineProperty','CloudRemoteCache',a0_0x58a4('0x28'),a0_0x58a4('0x15'),a0_0x58a4('0x31'),'join','../../file-storage/e2e-encryption','apply',a0_0x58a4('0x4d'),a0_0x58a4('0x24'),a0_0x58a4('0x1c'),a0_0x58a4('0xc'),a0_0x58a4('0x6d'),a0_0x58a4('0x16'),'getRunGroup',a0_0x58a4('0x3d'),a0_0x58a4('0x3c'),a0_0x58a4('0x42'),a0_0x58a4('0x5f'),'writeFileSync',a0_0x58a4('0x79'),a0_0x58a4('0x72'),a0_0x58a4('0x47'),a0_0x58a4('0x69'),a0_0x58a4('0x5b'),'./cloud-remote-cache',a0_0x58a4('0x27'),a0_0x58a4('0x1b'),a0_0x58a4('0x3'),a0_0x58a4('0x5e'),a0_0x58a4('0x0'),'VERBOSE_LOGGING',a0_0x58a4('0x10'),a0_0x58a4('0x3b'),a0_0x58a4('0x23'),a0_0x58a4('0x63'),a0_0x58a4('0x19'),'env','@nrwl/workspace/src/tasks-runner/tasks-runner-v2',a0_0x58a4('0x7e'),a0_0x58a4('0x12'),a0_0x58a4('0xd'),'../../file-storage/file-storage','rxjs/internal/Subject',a0_0x58a4('0x11'),a0_0x58a4('0x55'),a0_0x58a4('0x3e'),a0_0x58a4('0x1a'),a0_0x58a4('0x2e'),a0_0x58a4('0x33'),'waitForStoreRequestsToComplete',a0_0x58a4('0x73'),a0_0x58a4('0x39'),a0_0x58a4('0x36'),a0_0x58a4('0x18'),a0_0x58a4('0x35'),a0_0x58a4('0x4f'),a0_0x58a4('0x45'),'complete',a0_0x58a4('0x46'),'submitRunMetrics',a0_0x58a4('0x60'),a0_0x58a4('0x4a'),a0_0x58a4('0x5'),a0_0x58a4('0x1e')];(function(_0x3867b2,_0x1ca55b){const _0x26c448=function(_0x20032c){while(--_0x20032c){_0x3867b2['push'](_0x3867b2[a0_0x58a4('0xb')]());}};_0x26c448(++_0x1ca55b);}(a0_0x35c2,0x1a0));const a0_0x4ba5=function(_0x423008,_0x433b20){_0x423008=_0x423008-0x0;let _0x56c9b0=a0_0x35c2[_0x423008];return _0x56c9b0;};a0_0x58a4('0x2c');var __awaiter=this&&this[a0_0x4ba5(a0_0x58a4('0x3f'))]||function(_0x7ce70b,_0x560f18,_0x3d7e06,_0x34c430){function _0x2cdfee(_0x2c5c6b){return _0x2c5c6b instanceof _0x3d7e06?_0x2c5c6b:new _0x3d7e06(function(_0x5b7b18){_0x5b7b18(_0x2c5c6b);});}return new(_0x3d7e06||(_0x3d7e06=Promise))(function(_0x5395b9,_0x2bce6c){function _0x1e2533(_0x13ce91){try{_0x36cd31(_0x34c430[a0_0x4ba5(a0_0x58a4('0x6c'))](_0x13ce91));}catch(_0x5e16b9){_0x2bce6c(_0x5e16b9);}}function _0x2c89a5(_0x4d6c90){try{_0x36cd31(_0x34c430[a0_0x4ba5(a0_0x58a4('0x48'))](_0x4d6c90));}catch(_0xc52531){_0x2bce6c(_0xc52531);}}function _0x36cd31(_0x48a55b){_0x48a55b[a0_0x58a4('0x22')]?_0x5395b9(_0x48a55b[a0_0x4ba5(a0_0x58a4('0x49'))]):_0x2cdfee(_0x48a55b[a0_0x58a4('0x2a')])[a0_0x4ba5(a0_0x58a4('0x40'))](_0x1e2533,_0x2c89a5);}_0x36cd31((_0x34c430=_0x34c430[a0_0x4ba5(a0_0x58a4('0x5d'))](_0x7ce70b,_0x560f18||[]))[a0_0x4ba5(a0_0x58a4('0x6c'))]());});};Object[a0_0x4ba5(a0_0x58a4('0x6'))](exports,a0_0x4ba5(a0_0x58a4('0x6a')),{'value':!![]});exports[a0_0x4ba5(a0_0x58a4('0x68'))]=void 0x0;const Subject_1=require(a0_0x4ba5(a0_0x58a4('0x25')));const message_reporter_1=require(a0_0x4ba5('0x2d'));const end_of_run_message_1=require(a0_0x4ba5(a0_0x58a4('0xe')));const output_obfuscator_1=require(a0_0x4ba5(a0_0x58a4('0x17')));const task_runner_life_cycle_1=require(a0_0x58a4('0x37'));const file_storage_1=require(a0_0x4ba5(a0_0x58a4('0x2f')));const e2e_encryption_1=require(a0_0x4ba5(a0_0x58a4('0x29')));const environment_1=require(a0_0x58a4('0x66'));const cloud_remote_cache_1=require(a0_0x4ba5(a0_0x58a4('0x56')));const tasks_runner_v2_1=require(a0_0x4ba5(a0_0x58a4('0x2b')));const output_1=require(a0_0x4ba5(a0_0x58a4('0x4e')));const cloud_run_api_1=require(a0_0x4ba5(a0_0x58a4('0x32')));const fs_1=require('fs');const path=require(a0_0x4ba5(a0_0x58a4('0x61')));const metric_logger_1=require(a0_0x4ba5('0x3f'));function createApi(_0x57ff80,_0x140cd7,_0x4ad9c6){const _0x2acb7f=(0x0,environment_1[a0_0x4ba5(a0_0x58a4('0x1d'))])(_0x140cd7);return new cloud_run_api_1[(a0_0x4ba5(a0_0x58a4('0x3a')))](_0x57ff80,_0x4ad9c6,_0x140cd7,_0x2acb7f);}function storeTaskHashes(_0x24eb8a,_0x49d2af){const _0x5b4bc1=JSON[a0_0x58a4('0x3')](_0x24eb8a[a0_0x4ba5(a0_0x58a4('0x54'))](_0x41b316=>({'taskId':_0x41b316[a0_0x4ba5(a0_0x58a4('0x4'))],'hash':_0x41b316[a0_0x4ba5(a0_0x58a4('0x51'))]})));if(environment_1[a0_0x4ba5('0x36')]){output_1[a0_0x4ba5(a0_0x58a4('0x41'))][a0_0x4ba5(a0_0x58a4('0x13'))]({'title':a0_0x4ba5('0x35')+_0x5b4bc1});}(0x0,fs_1[a0_0x4ba5(a0_0x58a4('0x62'))])(path[a0_0x4ba5(a0_0x58a4('0x20'))](_0x49d2af,a0_0x58a4('0xa')),_0x5b4bc1);}function cloudEnabledTasksRunner(_0x164e06,_0x5e7349,_0x315e64){const _0x8fcd76={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0x164e06};const _0x2461af=new message_reporter_1[(a0_0x4ba5('0x40'))](_0x5e7349);const _0x3a18c0=createApi(_0x2461af,_0x5e7349,_0x8fcd76);const _0x25f6c5=new end_of_run_message_1[(a0_0x4ba5(a0_0x58a4('0x7a')))](_0x2461af,_0x8fcd76);const _0x18b889=new output_obfuscator_1[(a0_0x4ba5(a0_0x58a4('0x59')))]();const _0x1f6859=_0x164e06[a0_0x58a4('0x5')](_0x365af8=>_0x365af8[a0_0x4ba5(a0_0x58a4('0x51'))])[a0_0x4ba5(a0_0x58a4('0x50'))](_0x1a8948=>!!_0x1a8948);const _0x34301c=_0x3a18c0[a0_0x4ba5(a0_0x58a4('0x75'))](environment_1[a0_0x58a4('0x4f')],_0x1f6859);_0x1f6859[a0_0x58a4('0x52')](_0x295402=>{_0x8fcd76[a0_0x4ba5(a0_0x58a4('0x30'))][_0x295402]=_0x34301c;});const _0x48e3a6=new Date()['toISOString']();const _0x3adba1=new task_runner_life_cycle_1[(a0_0x4ba5('0x0'))](_0x8fcd76,_0x5e7349['cacheDirectory'],_0x5e7349[a0_0x58a4('0x72')]===undefined?!![]:_0x5e7349[a0_0x4ba5('0x2c')],_0x5e7349[a0_0x4ba5(a0_0x58a4('0x6e'))]||[],_0x18b889);const _0x411091=new e2e_encryption_1[(a0_0x4ba5('0x1f'))](environment_1[a0_0x58a4('0x1')]||_0x5e7349[a0_0x4ba5(a0_0x58a4('0x74'))]);const _0x13b0a4=new file_storage_1[(a0_0x4ba5(a0_0x58a4('0x6f')))](_0x411091,environment_1[a0_0x58a4('0x53')]);const _0x5b30fb=new cloud_remote_cache_1[(a0_0x4ba5(a0_0x58a4('0x8')))](_0x2461af,_0x3a18c0,_0x8fcd76,_0x13b0a4);delete process[a0_0x4ba5(a0_0x58a4('0x4c'))]['NX_CLOUD_DISTRIBUTED_EXECUTION_ID'];const _0x211bd6=(0x0,tasks_runner_v2_1[a0_0x4ba5('0x16')])(_0x164e06,Object['assign'](Object[a0_0x58a4('0x2')]({},_0x5e7349),{'remoteCache':_0x5b30fb,'lifeCycle':_0x3adba1}),_0x315e64);const _0x4677ea=new Subject_1[(a0_0x58a4('0x44'))]();_0x211bd6[a0_0x4ba5('0x44')]({'next':_0x1717d4=>_0x4677ea[a0_0x4ba5(a0_0x58a4('0x6c'))](_0x1717d4),'error':_0x2ea889=>_0x4677ea[a0_0x4ba5(a0_0x58a4('0x64'))](_0x2ea889),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){const _0x119675=new Date()[a0_0x4ba5(a0_0x58a4('0x2d'))]();if(environment_1[a0_0x4ba5('0x36')]){const _0x4cdaf9=_0x3adba1[a0_0x4ba5('0x43')][a0_0x4ba5(a0_0x58a4('0x54'))](_0x5c0c8b=>{return Object[a0_0x4ba5(a0_0x58a4('0x77'))](Object[a0_0x58a4('0x2')]({},_0x5c0c8b),{'terminalOutput':_0x5c0c8b['terminalOutput']?_0x5c0c8b[a0_0x58a4('0x9')][a0_0x4ba5(a0_0x58a4('0x58'))](0x0,0x14)+a0_0x4ba5('0x4'):undefined});});output_1[a0_0x4ba5(a0_0x58a4('0x41'))][a0_0x4ba5(a0_0x58a4('0x13'))]({'title':a0_0x4ba5(a0_0x58a4('0x6b')),'bodyLines':['\x0a'+JSON[a0_0x4ba5(a0_0x58a4('0x57'))](_0x4cdaf9,null,0x2)]});}if(environment_1[a0_0x4ba5(a0_0x58a4('0x5a'))]){storeTaskHashes(_0x3adba1[a0_0x58a4('0x11')],_0x5e7349[a0_0x4ba5(a0_0x58a4('0x14'))]||a0_0x4ba5('0x34'));}const _0x5380fd=(0x0,environment_1[a0_0x58a4('0x7')])();const _0x27f4d0=yield Promise[a0_0x4ba5('0x6')]([_0x5b30fb[a0_0x4ba5(a0_0x58a4('0x7d'))](),_0x3a18c0[a0_0x4ba5(a0_0x58a4('0x1f'))]({'command':_0x18b889[a0_0x58a4('0x70')]((0x0,environment_1[a0_0x4ba5(a0_0x58a4('0x38'))])()),'startTime':_0x48e3a6,'endTime':_0x119675,'distributedExecutionId':environment_1[a0_0x4ba5(a0_0x58a4('0x78'))],'branch':_0x5380fd,'scan':!![],'runGroup':(0x0,environment_1[a0_0x4ba5(a0_0x58a4('0x71'))])(),'sha':_0x5380fd?(0x0,environment_1[a0_0x4ba5(a0_0x58a4('0x26'))])():undefined},_0x3adba1[a0_0x4ba5(a0_0x58a4('0x21'))])]);_0x2461af[a0_0x4ba5(a0_0x58a4('0xf'))]();_0x25f6c5[a0_0x4ba5(a0_0x58a4('0x21'))]=_0x3adba1[a0_0x4ba5(a0_0x58a4('0x21'))];if(environment_1[a0_0x4ba5(a0_0x58a4('0x5a'))]){if(!_0x27f4d0[0x0]){output_1[a0_0x4ba5(a0_0x58a4('0x41'))][a0_0x4ba5(a0_0x58a4('0x64'))]({'title':'Agent\x20wasn\x27t\x20able\x20to\x20store\x20artifacts'});process[a0_0x4ba5(a0_0x58a4('0x5c'))](environment_1[a0_0x4ba5(a0_0x58a4('0x34'))]);}if(!_0x27f4d0[0x1]){output_1[a0_0x4ba5(a0_0x58a4('0x41'))][a0_0x58a4('0x3e')]({'title':a0_0x4ba5('0x39')});process[a0_0x58a4('0x3d')](environment_1[a0_0x4ba5(a0_0x58a4('0x34'))]);}}try{yield(0x0,metric_logger_1[a0_0x4ba5(a0_0x58a4('0x65'))])(_0x5e7349);}catch(_0x46b304){}_0x4677ea[a0_0x4ba5(a0_0x58a4('0x43'))]();})});return _0x4677ea;}exports[a0_0x4ba5(a0_0x58a4('0x68'))]=cloudEnabledTasksRunner;
|
|
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.cloudEnabledTasksRunner = void 0;
|
|
13
|
+
const Subject_1 = require("rxjs/internal/Subject");
|
|
14
|
+
const message_reporter_1 = require("../../terminal-output/message-reporter");
|
|
15
|
+
const end_of_run_message_1 = require("../../terminal-output/end-of-run-message");
|
|
16
|
+
const output_obfuscator_1 = require("../../terminal-output/output-obfuscator");
|
|
17
|
+
const cloud_enabled_life_cycle_1 = require("./cloud-enabled-life-cycle");
|
|
18
|
+
const file_storage_1 = require("../../file-storage/file-storage");
|
|
19
|
+
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
|
|
20
|
+
const environment_1 = require("../../../utilities/environment");
|
|
21
|
+
const cloud_remote_cache_1 = require("./cloud-remote-cache");
|
|
22
|
+
const tasks_runner_v2_1 = require("@nrwl/workspace/src/tasks-runner/tasks-runner-v2");
|
|
23
|
+
const output_1 = require("@nrwl/workspace/src/utilities/output");
|
|
24
|
+
const cloud_run_api_1 = require("./cloud-run.api");
|
|
25
|
+
const fs_1 = require("fs");
|
|
26
|
+
const path = require("path");
|
|
27
|
+
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
28
|
+
function createApi(errors, options, runContext) {
|
|
29
|
+
const machineInfo = (0, environment_1.getMachineInfo)(options);
|
|
30
|
+
return new cloud_run_api_1.CloudRunApi(errors, runContext, options, machineInfo);
|
|
31
|
+
}
|
|
32
|
+
function storeTaskHashes(taskExecutions, directory) {
|
|
33
|
+
const hashes = JSON.stringify(taskExecutions.map((t) => ({
|
|
34
|
+
taskId: t.taskId,
|
|
35
|
+
hash: t.hash,
|
|
36
|
+
})));
|
|
37
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
38
|
+
output_1.output.note({
|
|
39
|
+
title: `Executed tasks with hashes: ${hashes}`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
(0, fs_1.writeFileSync)(path.join(directory, 'tasks-hashes'), hashes);
|
|
43
|
+
}
|
|
44
|
+
function onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const runEndTime = new Date().toISOString();
|
|
47
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
48
|
+
const tasks = taskExecutions.map((tt) => {
|
|
49
|
+
return Object.assign(Object.assign({}, tt), { terminalOutput: tt.terminalOutput
|
|
50
|
+
? `${tt.terminalOutput.slice(0, 20)}...`
|
|
51
|
+
: undefined });
|
|
52
|
+
});
|
|
53
|
+
output_1.output.note({
|
|
54
|
+
title: 'Completed tasks',
|
|
55
|
+
bodyLines: ['\n' + JSON.stringify(tasks, null, 2)],
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
|
|
59
|
+
storeTaskHashes(taskExecutions, options.cacheDirectory || './node_modules/.cache/nx');
|
|
60
|
+
}
|
|
61
|
+
const branch = (0, environment_1.getBranch)();
|
|
62
|
+
const endRequest = yield Promise.all([
|
|
63
|
+
remoteCache.waitForStoreRequestsToComplete(),
|
|
64
|
+
api.endRun({
|
|
65
|
+
command: outputObfuscator.obfuscate((0, environment_1.parseCommand)()),
|
|
66
|
+
startTime: runStartTime,
|
|
67
|
+
endTime: runEndTime,
|
|
68
|
+
distributedExecutionId: environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID,
|
|
69
|
+
branch: branch,
|
|
70
|
+
scan: true,
|
|
71
|
+
runGroup: (0, environment_1.getRunGroup)(),
|
|
72
|
+
// only set sha if branch is set cause we invoke a separate process,
|
|
73
|
+
// which adds a few millis
|
|
74
|
+
sha: branch ? (0, environment_1.extractGitSha)() : undefined,
|
|
75
|
+
}, taskExecutions),
|
|
76
|
+
]);
|
|
77
|
+
messages.printMessages();
|
|
78
|
+
if (!messages.anyErrors) {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
endOfRunMessage.printCacheHitsMessage();
|
|
81
|
+
}, 0);
|
|
82
|
+
}
|
|
83
|
+
if (environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION) {
|
|
84
|
+
if (!endRequest[0]) {
|
|
85
|
+
output_1.output.error({
|
|
86
|
+
title: `Agent wasn't able to store artifacts`,
|
|
87
|
+
});
|
|
88
|
+
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
|
|
89
|
+
}
|
|
90
|
+
if (!endRequest[1]) {
|
|
91
|
+
output_1.output.error({
|
|
92
|
+
title: `Agent wasn't able to record its run`,
|
|
93
|
+
});
|
|
94
|
+
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
yield (0, metric_logger_1.submitRunMetrics)(options);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function createLifeCycle(runContext, options, outputObfuscator, tasks) {
|
|
101
|
+
const cloudEnabledLifeCycle = new cloud_enabled_life_cycle_1.CloudEnabledLifeCycle(runContext, options.cacheDirectory, options.scan === undefined ? true : options.scan, options.cacheableOperations || [], outputObfuscator, tasks);
|
|
102
|
+
try {
|
|
103
|
+
const { CompositeLifeCycle, } = require('@nrwl/workspace/src/tasks-runner/life-cycle');
|
|
104
|
+
if (!CompositeLifeCycle)
|
|
105
|
+
return cloudEnabledLifeCycle;
|
|
106
|
+
return new CompositeLifeCycle([options.lifeCycle, cloudEnabledLifeCycle]);
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
return cloudEnabledLifeCycle;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function cloudEnabledTasksRunner(tasks, options, context) {
|
|
113
|
+
const runContext = {
|
|
114
|
+
statuses: {},
|
|
115
|
+
scheduledTasks: [],
|
|
116
|
+
requests: {},
|
|
117
|
+
allTasks: tasks,
|
|
118
|
+
};
|
|
119
|
+
const taskExecutions = [];
|
|
120
|
+
const messages = new message_reporter_1.MessageReporter(options);
|
|
121
|
+
const api = createApi(messages, options, runContext);
|
|
122
|
+
const endOfRunMessage = new end_of_run_message_1.EndOfRunMessage(runContext, taskExecutions);
|
|
123
|
+
const outputObfuscator = new output_obfuscator_1.OutputObfuscator();
|
|
124
|
+
const hashes = tasks.map((t) => t.hash).filter((h) => !!h);
|
|
125
|
+
const startRunRequest = api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, hashes);
|
|
126
|
+
hashes.forEach((hash) => {
|
|
127
|
+
runContext.requests[hash] = startRunRequest;
|
|
128
|
+
});
|
|
129
|
+
const runStartTime = new Date().toISOString();
|
|
130
|
+
const lifeCycle = createLifeCycle(runContext, options, outputObfuscator, taskExecutions);
|
|
131
|
+
const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
|
|
132
|
+
const fileStorage = new file_storage_1.FileStorage(encryption, environment_1.NUMBER_OF_TRIES);
|
|
133
|
+
const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage);
|
|
134
|
+
// have to reset it so we don't capture inner tasks
|
|
135
|
+
delete process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
|
|
136
|
+
const res = (0, tasks_runner_v2_1.tasksRunnerV2)(tasks, Object.assign(Object.assign({}, options), { remoteCache, lifeCycle }), context);
|
|
137
|
+
// observable -> legacy
|
|
138
|
+
if (res.subscribe) {
|
|
139
|
+
const wrappedRes = new Subject_1.Subject();
|
|
140
|
+
res.subscribe({
|
|
141
|
+
next: (value) => wrappedRes.next(value),
|
|
142
|
+
error: (err) => wrappedRes.error(err),
|
|
143
|
+
complete: () => __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions);
|
|
145
|
+
wrappedRes.complete();
|
|
146
|
+
}),
|
|
147
|
+
});
|
|
148
|
+
return wrappedRes;
|
|
149
|
+
// promise
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return res
|
|
153
|
+
.then((r) => __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions);
|
|
155
|
+
return r;
|
|
156
|
+
}))
|
|
157
|
+
.catch((e) => __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
yield onComplete(lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions);
|
|
159
|
+
throw e;
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.cloudEnabledTasksRunner = cloudEnabledTasksRunner;
|
|
164
|
+
//# sourceMappingURL=cloud-enabled.runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-enabled.runner.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-packages/nx-cloud/src/lib/core/runners/cloud-enabled/cloud-enabled.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,mDAAgD;AAEhD,6EAAyE;AACzE,iFAA2E;AAC3E,+EAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"cloud-enabled.runner.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-packages/nx-cloud/src/lib/core/runners/cloud-enabled/cloud-enabled.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,mDAAgD;AAEhD,6EAAyE;AACzE,iFAA2E;AAC3E,+EAA2E;AAC3E,yEAAmE;AACnE,kEAA8D;AAC9D,sEAAkE;AAClE,gEAYwC;AACxC,6DAAwD;AACxD,sFAAiF;AACjF,iEAA8D;AAC9D,mDAA8C;AAE9C,2BAAmC;AACnC,6BAA6B;AAC7B,oEAAoE;AAEpE,SAAS,SAAS,CAChB,MAAuB,EACvB,OAA+B,EAC/B,UAAsB;IAEtB,MAAM,WAAW,GAAG,IAAA,4BAAc,EAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,IAAI,2BAAW,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,eAAe,CAAC,cAA+B,EAAE,SAAiB;IACzE,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAC3B,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzB,MAAM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Q,EAAE,CAAC;YACxB,CAAC,CAAA;SACF,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;QAClB,UAAU;KACX;SAAM;QACL,OAAO,GAAG;aACP,IAAI,CAAC,CAAO,CAAC,EAAE,EAAE;YAChB,MAAM,UAAU,CACd,SAAS,EACT,OAAO,EACP,WAAW,EACX,GAAG,EACH,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,cAAc,CACf,CAAC;YACF,OAAO,CAAC,CAAC;QACX,CAAC,CAAA,CAAC;aACD,KAAK,CAAC,CAAO,CAAC,EAAE,EAAE;YACjB,MAAM,UAAU,CACd,SAAS,EACT,OAAO,EACP,WAAW,EACX,GAAG,EACH,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,cAAc,CACf,CAAC;YACF,MAAM,CAAC,CAAC;QACV,CAAC,CAAA,CAAC,CAAC;KACN;AACH,CAAC;AAxGD,0DAwGC"}
|
|
@@ -1 +1,113 @@
|
|
|
1
|
-
|
|
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.CloudRemoteCache = void 0;
|
|
13
|
+
const output_1 = require("@nrwl/workspace/src/utilities/output");
|
|
14
|
+
const environment_1 = require("../../../utilities/environment");
|
|
15
|
+
class CloudRemoteCache {
|
|
16
|
+
constructor(messages, api, runContext, fileStorage) {
|
|
17
|
+
this.messages = messages;
|
|
18
|
+
this.api = api;
|
|
19
|
+
this.runContext = runContext;
|
|
20
|
+
this.fileStorage = fileStorage;
|
|
21
|
+
this.storeRequests = [];
|
|
22
|
+
}
|
|
23
|
+
retrieve(hash, cacheDirectory) {
|
|
24
|
+
var _a;
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (this.messages.cacheError)
|
|
27
|
+
return false;
|
|
28
|
+
const hashUrls = yield this.hashUrls(hash);
|
|
29
|
+
if (!hashUrls || !hashUrls.get) {
|
|
30
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
31
|
+
output_1.output.note({ title: `Nx Cloud: Cache miss ${hash}.` });
|
|
32
|
+
}
|
|
33
|
+
this.runContext.statuses[hash] = 'cache-miss';
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
yield this.fileStorage.retrieve(hash, hashUrls.get, cacheDirectory);
|
|
38
|
+
this.runContext.statuses[hash] = 'remote-cache-hit';
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch (ee) {
|
|
42
|
+
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
|
|
43
|
+
if (e.response && e.response.status === 404) {
|
|
44
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
45
|
+
output_1.output.note({ title: `Nx Cloud: Cache miss ${hash}. Status 404.` });
|
|
46
|
+
}
|
|
47
|
+
// cache miss. print nothing
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
|
|
51
|
+
}
|
|
52
|
+
this.runContext.statuses[hash] = 'cache-miss';
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
store(hash, cacheDirectory) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
if (this.messages.cacheError)
|
|
60
|
+
return false;
|
|
61
|
+
const res = Promise.resolve().then(() => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a;
|
|
63
|
+
const hashUrls = yield this.hashUrls(hash);
|
|
64
|
+
if (!hashUrls)
|
|
65
|
+
return false;
|
|
66
|
+
if (!hashUrls.put) {
|
|
67
|
+
if (environment_1.VERBOSE_LOGGING) {
|
|
68
|
+
output_1.output.note({
|
|
69
|
+
title: `Nx Cloud: Skipping storing ${hash}. Read only token is used.`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
yield this.fileStorage.store(hash, hashUrls.put, cacheDirectory);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch (ee) {
|
|
79
|
+
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
|
|
80
|
+
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
this.storeRequests.push(res);
|
|
85
|
+
return res;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
hashUrls(hash) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (hash in this.runContext.requests) {
|
|
91
|
+
return (yield this.runContext.requests[hash])[hash];
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const scheduledTaskHashesWithoutRequests = this.runContext.scheduledTasks
|
|
95
|
+
.filter((t) => !this.runContext.requests[t.hash])
|
|
96
|
+
.map((t) => t.hash);
|
|
97
|
+
if (scheduledTaskHashesWithoutRequests.indexOf(hash) === -1) {
|
|
98
|
+
scheduledTaskHashesWithoutRequests.push(hash);
|
|
99
|
+
}
|
|
100
|
+
const request = this.api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, scheduledTaskHashesWithoutRequests);
|
|
101
|
+
scheduledTaskHashesWithoutRequests.forEach((taskHash) => {
|
|
102
|
+
this.runContext.requests[taskHash] = request;
|
|
103
|
+
});
|
|
104
|
+
return (yield request)[hash];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
waitForStoreRequestsToComplete() {
|
|
109
|
+
return Promise.all(this.storeRequests).then((r) => r.reduce((a, b) => a && b, true));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.CloudRemoteCache = CloudRemoteCache;
|
|
113
|
+
//# sourceMappingURL=cloud-remote-cache.js.map
|