@nrwl/nx-cloud 14.5.0-beta.4 → 14.5.0
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/lib/core/api/error-reporter.api.js +1 -36
- package/lib/core/api/run-group.api.js +1 -68
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +1 -156
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -284
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +1 -113
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +1 -167
- package/lib/core/runners/cloud-enabled/id-generator.js +1 -16
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +1 -79
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +1 -263
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -143
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -220
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js +1 -37
- package/lib/core/runners/distributed-execution/task-graph-creator.js +1 -77
- package/package.json +1 -1
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
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.ErrorReporterApi = void 0;
|
|
13
|
-
const axios_1 = require("../../utilities/axios");
|
|
14
|
-
const { output } = require('../../utilities/nx-imports');
|
|
15
|
-
class ErrorReporterApi {
|
|
16
|
-
constructor(options) {
|
|
17
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
18
|
-
}
|
|
19
|
-
reportError(message) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
try {
|
|
22
|
-
yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/report-client-error', {
|
|
23
|
-
message,
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
output.warn({
|
|
28
|
-
title: `Unable to record the following error: '${message}'`,
|
|
29
|
-
bodyLines: [e.message],
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.ErrorReporterApi = ErrorReporterApi;
|
|
36
|
-
//# sourceMappingURL=error-reporter.api.js.map
|
|
1
|
+
const a0_0x2315=['__esModule','reportError','done','../../utilities/axios','Unable\x20to\x20record\x20the\x20following\x20error:\x20\x27','ErrorReporterApi','then','message','value','/nx-cloud/report-client-error','../../utilities/nx-imports','__awaiter','next','apply','throw','apiAxiosInstance','axiosMultipleTries'];(function(_0x5107c9,_0x2315ad){const _0x7edd18=function(_0x3635b8){while(--_0x3635b8){_0x5107c9['push'](_0x5107c9['shift']());}};_0x7edd18(++_0x2315ad);}(a0_0x2315,0x1b8));const a0_0x7edd=function(_0x5107c9,_0x2315ad){_0x5107c9=_0x5107c9-0x0;let _0x7edd18=a0_0x2315[_0x5107c9];return _0x7edd18;};'use strict';var __awaiter=this&&this[a0_0x7edd('0xd')]||function(_0x525481,_0x51c3a1,_0x182ac5,_0x317d96){function _0x252be6(_0x94f6ed){return _0x94f6ed instanceof _0x182ac5?_0x94f6ed:new _0x182ac5(function(_0x310337){_0x310337(_0x94f6ed);});}return new(_0x182ac5||(_0x182ac5=Promise))(function(_0x262db0,_0x2ef727){function _0x5ad2ff(_0x268147){try{_0x26e0ca(_0x317d96['next'](_0x268147));}catch(_0x383649){_0x2ef727(_0x383649);}}function _0x2fdda1(_0x59e99d){try{_0x26e0ca(_0x317d96[a0_0x7edd('0x10')](_0x59e99d));}catch(_0x277ccf){_0x2ef727(_0x277ccf);}}function _0x26e0ca(_0x1fa1cb){_0x1fa1cb[a0_0x7edd('0x4')]?_0x262db0(_0x1fa1cb[a0_0x7edd('0xa')]):_0x252be6(_0x1fa1cb[a0_0x7edd('0xa')])[a0_0x7edd('0x8')](_0x5ad2ff,_0x2fdda1);}_0x26e0ca((_0x317d96=_0x317d96[a0_0x7edd('0xf')](_0x525481,_0x51c3a1||[]))[a0_0x7edd('0xe')]());});};Object['defineProperty'](exports,a0_0x7edd('0x2'),{'value':!![]});exports[a0_0x7edd('0x7')]=void 0x0;const axios_1=require(a0_0x7edd('0x5'));const {output}=require(a0_0x7edd('0xc'));class ErrorReporterApi{constructor(_0x50c0d2){this[a0_0x7edd('0x0')]=(0x0,axios_1['createApiAxiosInstance'])(_0x50c0d2);}[a0_0x7edd('0x3')](_0x585664){return __awaiter(this,void 0x0,void 0x0,function*(){try{yield(0x0,axios_1[a0_0x7edd('0x1')])(()=>this[a0_0x7edd('0x0')]['post'](a0_0x7edd('0xb'),{'message':_0x585664}));}catch(_0x51b069){output['warn']({'title':a0_0x7edd('0x6')+_0x585664+'\x27','bodyLines':[_0x51b069[a0_0x7edd('0x9')]]});}});}}exports[a0_0x7edd('0x7')]=ErrorReporterApi;
|
|
@@ -1,68 +1 @@
|
|
|
1
|
-
|
|
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 axios_1 = require("../../utilities/axios");
|
|
14
|
-
const metric_logger_1 = require("../../utilities/metric-logger");
|
|
15
|
-
const { output } = require('../../utilities/nx-imports');
|
|
16
|
-
class RunGroupApi {
|
|
17
|
-
constructor(options) {
|
|
18
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
19
|
-
}
|
|
20
|
-
createRunGroup(branch, runGroup, stopAgentsOnFailure, agentCount, stopAgentsAfter) {
|
|
21
|
-
var _a;
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
|
|
24
|
-
try {
|
|
25
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/create-run-group', {
|
|
26
|
-
branch,
|
|
27
|
-
runGroup,
|
|
28
|
-
stopAgentsOnFailure,
|
|
29
|
-
agentCount,
|
|
30
|
-
stopAgentsAfter,
|
|
31
|
-
}));
|
|
32
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
36
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
37
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
38
|
-
output.error({
|
|
39
|
-
title: e.message,
|
|
40
|
-
});
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
completeRunGroup(runGroup) {
|
|
46
|
-
var _a;
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
|
|
49
|
-
try {
|
|
50
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
51
|
-
runGroup: runGroup,
|
|
52
|
-
}));
|
|
53
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
57
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
58
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
59
|
-
output.error({
|
|
60
|
-
title: e.message,
|
|
61
|
-
});
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.RunGroupApi = RunGroupApi;
|
|
68
|
-
//# sourceMappingURL=run-group.api.js.map
|
|
1
|
+
const a1_0x5641=['mapRespToPerfEntry','exit','response','../../utilities/nx-imports','/nx-cloud/executions/create-run-group','apply','axiosMultipleTries','completeRunGroup','defineProperty','createRunGroup','createApiAxiosInstance','createMetricRecorder','message','next','../../utilities/metric-logger','apiAxiosInstance','post','RUNNER_FAILURE_PERF_ENTRY','error','__esModule','../../utilities/axios','axiosException','RunGroupApi','value','__awaiter','done','recordMetric','then'];(function(_0xd5d1e,_0x564185){const _0x3ce1a4=function(_0x88b601){while(--_0x88b601){_0xd5d1e['push'](_0xd5d1e['shift']());}};_0x3ce1a4(++_0x564185);}(a1_0x5641,0x67));const a1_0x3ce1=function(_0xd5d1e,_0x564185){_0xd5d1e=_0xd5d1e-0x0;let _0x3ce1a4=a1_0x5641[_0xd5d1e];return _0x3ce1a4;};'use strict';var __awaiter=this&&this[a1_0x3ce1('0x5')]||function(_0x18cca3,_0x13a7f7,_0x376fed,_0x36bdaa){function _0x29ca47(_0x4442af){return _0x4442af instanceof _0x376fed?_0x4442af:new _0x376fed(function(_0x6036c3){_0x6036c3(_0x4442af);});}return new(_0x376fed||(_0x376fed=Promise))(function(_0x4cf0d1,_0x59dccc){function _0x2a7119(_0x51139f){try{_0x1a6845(_0x36bdaa[a1_0x3ce1('0x16')](_0x51139f));}catch(_0x4c6788){_0x59dccc(_0x4c6788);}}function _0x2c63df(_0x975ab5){try{_0x1a6845(_0x36bdaa['throw'](_0x975ab5));}catch(_0x3f8fe4){_0x59dccc(_0x3f8fe4);}}function _0x1a6845(_0x21e11a){_0x21e11a[a1_0x3ce1('0x6')]?_0x4cf0d1(_0x21e11a[a1_0x3ce1('0x4')]):_0x29ca47(_0x21e11a['value'])[a1_0x3ce1('0x8')](_0x2a7119,_0x2c63df);}_0x1a6845((_0x36bdaa=_0x36bdaa[a1_0x3ce1('0xe')](_0x18cca3,_0x13a7f7||[]))[a1_0x3ce1('0x16')]());});};Object[a1_0x3ce1('0x11')](exports,a1_0x3ce1('0x0'),{'value':!![]});exports['RunGroupApi']=void 0x0;const axios_1=require(a1_0x3ce1('0x1'));const metric_logger_1=require(a1_0x3ce1('0x17'));const {output}=require(a1_0x3ce1('0xc'));class RunGroupApi{constructor(_0x17f29f){this[a1_0x3ce1('0x18')]=(0x0,axios_1[a1_0x3ce1('0x13')])(_0x17f29f);}['createRunGroup'](_0x21e4fe,_0x5a97cc,_0x21822f,_0x2a02d8,_0x381138){var _0xba6511;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x905226=(0x0,metric_logger_1['createMetricRecorder'])(a1_0x3ce1('0x12'));try{const _0x3dc325=yield(0x0,axios_1[a1_0x3ce1('0xf')])(()=>this[a1_0x3ce1('0x18')]['post'](a1_0x3ce1('0xd'),{'branch':_0x21e4fe,'runGroup':_0x5a97cc,'stopAgentsOnFailure':_0x21822f,'agentCount':_0x2a02d8,'stopAgentsAfter':_0x381138}));_0x905226[a1_0x3ce1('0x7')]((0x0,metric_logger_1[a1_0x3ce1('0x9')])(_0x3dc325));}catch(_0x59706d){_0x905226[a1_0x3ce1('0x7')](((_0xba6511=_0x59706d===null||_0x59706d===void 0x0?void 0x0:_0x59706d['axiosException'])===null||_0xba6511===void 0x0?void 0x0:_0xba6511[a1_0x3ce1('0xb')])?(0x0,metric_logger_1['mapRespToPerfEntry'])(_0x59706d[a1_0x3ce1('0x2')][a1_0x3ce1('0xb')]):metric_logger_1[a1_0x3ce1('0x1a')]);output[a1_0x3ce1('0x1b')]({'title':_0x59706d['message']});process[a1_0x3ce1('0xa')](0x1);}});}[a1_0x3ce1('0x10')](_0x4315bc){var _0x69a9f6;return __awaiter(this,void 0x0,void 0x0,function*(){const _0xbf5053=(0x0,metric_logger_1[a1_0x3ce1('0x14')])(a1_0x3ce1('0x12'));try{const _0x559b70=yield(0x0,axios_1[a1_0x3ce1('0xf')])(()=>this[a1_0x3ce1('0x18')][a1_0x3ce1('0x19')]('/nx-cloud/executions/complete-run-group',{'runGroup':_0x4315bc}));_0xbf5053['recordMetric']((0x0,metric_logger_1[a1_0x3ce1('0x9')])(_0x559b70));}catch(_0x38a7ca){_0xbf5053[a1_0x3ce1('0x7')](((_0x69a9f6=_0x38a7ca===null||_0x38a7ca===void 0x0?void 0x0:_0x38a7ca['axiosException'])===null||_0x69a9f6===void 0x0?void 0x0:_0x69a9f6[a1_0x3ce1('0xb')])?(0x0,metric_logger_1[a1_0x3ce1('0x9')])(_0x38a7ca[a1_0x3ce1('0x2')][a1_0x3ce1('0xb')]):metric_logger_1[a1_0x3ce1('0x1a')]);output['error']({'title':_0x38a7ca[a1_0x3ce1('0x15')]});process[a1_0x3ce1('0xa')](0x1);}});}}exports[a1_0x3ce1('0x3')]=RunGroupApi;
|
|
@@ -1,156 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CloudEnabledLifeCycle = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const environment_1 = require("../../../utilities/environment");
|
|
8
|
-
const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
|
|
9
|
-
const { workspaceRoot } = require('../../../utilities/nx-imports');
|
|
10
|
-
class CloudEnabledLifeCycle {
|
|
11
|
-
constructor(runContext, cacheDirectory, skipNxCache, collectTerminalOutput, cacheableOperations, outputObfuscator, tasks) {
|
|
12
|
-
this.runContext = runContext;
|
|
13
|
-
this.cacheDirectory = cacheDirectory;
|
|
14
|
-
this.skipNxCache = skipNxCache;
|
|
15
|
-
this.collectTerminalOutput = collectTerminalOutput;
|
|
16
|
-
this.cacheableOperations = cacheableOperations;
|
|
17
|
-
this.outputObfuscator = outputObfuscator;
|
|
18
|
-
this.tasks = tasks;
|
|
19
|
-
}
|
|
20
|
-
scheduleTask(task) {
|
|
21
|
-
this.runContext.scheduledTasks.push(task);
|
|
22
|
-
}
|
|
23
|
-
startTask(task) {
|
|
24
|
-
this.tasks.push({
|
|
25
|
-
taskId: task.id,
|
|
26
|
-
startTime: new Date().toISOString(),
|
|
27
|
-
target: task.target.target,
|
|
28
|
-
projectName: task.target.project,
|
|
29
|
-
hash: task.hash,
|
|
30
|
-
hashDetails: this.cleanUpHashDetails(task.hashDetails),
|
|
31
|
-
params: (0, serializer_overrides_1.serializeOverrides)(task),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
// Used for older version for Nx. Remove in Dec 2022
|
|
35
|
-
endTask(task, code) {
|
|
36
|
-
let cacheStatus;
|
|
37
|
-
if (this.runContext.statuses[task.hash]) {
|
|
38
|
-
cacheStatus = this.runContext.statuses[task.hash];
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
if (this.cacheableOperations.indexOf(task.target.target) > -1 &&
|
|
42
|
-
!this.skipNxCache) {
|
|
43
|
-
cacheStatus = 'local-cache-hit';
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
cacheStatus = 'cache-miss';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
this.updateStartedTask(task, code, cacheStatus);
|
|
50
|
-
}
|
|
51
|
-
endTasks(tasks) {
|
|
52
|
-
for (let t of tasks) {
|
|
53
|
-
let cacheStatus;
|
|
54
|
-
const taskIsRemoteCacheHit = t.status === 'remote-cache';
|
|
55
|
-
const taskIsLocalCacheHitPreNx135 = t.status === 'cache';
|
|
56
|
-
const taskIsLocalCacheHit = t.status === 'local-cache' ||
|
|
57
|
-
t.status === 'local-cache-kept-existing' ||
|
|
58
|
-
taskIsLocalCacheHitPreNx135;
|
|
59
|
-
if (this.runContext.statuses[t.task.hash]) {
|
|
60
|
-
cacheStatus = this.runContext.statuses[t.task.hash];
|
|
61
|
-
}
|
|
62
|
-
else if (taskIsRemoteCacheHit) {
|
|
63
|
-
cacheStatus = 'remote-cache-hit';
|
|
64
|
-
}
|
|
65
|
-
else if (taskIsLocalCacheHit) {
|
|
66
|
-
cacheStatus = 'local-cache-hit';
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
if (this.cacheableOperations.indexOf(t.task.target.target) > -1 &&
|
|
70
|
-
!this.skipNxCache) {
|
|
71
|
-
cacheStatus = 'local-cache-hit';
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
cacheStatus = 'cache-miss';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
this.updateStartedTask(t.task, t.code, cacheStatus);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
endCommand() { }
|
|
81
|
-
updateStartedTask(task, code, cacheStatus) {
|
|
82
|
-
const startedTask = this.tasks.find((t) => t.taskId === task.id);
|
|
83
|
-
if (!startedTask) {
|
|
84
|
-
throw new Error(`Cannot find task ${task.id}`);
|
|
85
|
-
}
|
|
86
|
-
startedTask.endTime = new Date().toISOString();
|
|
87
|
-
startedTask.status = code;
|
|
88
|
-
startedTask.params = this.outputObfuscator.obfuscate(startedTask.params);
|
|
89
|
-
startedTask.cacheStatus = cacheStatus;
|
|
90
|
-
if (this.collectTerminalOutput) {
|
|
91
|
-
startedTask.terminalOutput = this.getTerminalOutput(task.hash, startedTask.cacheStatus, code);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
getTerminalOutput(hash, cacheStatus, code) {
|
|
95
|
-
let dir;
|
|
96
|
-
if (this.cacheDirectory) {
|
|
97
|
-
if (this.cacheDirectory.startsWith('./')) {
|
|
98
|
-
dir = (0, path_1.join)(workspaceRoot, this.cacheDirectory);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
dir = this.cacheDirectory;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
dir = (0, path_1.join)(workspaceRoot, 'node_modules', '.cache', 'nx');
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
const taskOutput = this.readTerminalOutputFile(dir, hash);
|
|
109
|
-
const taskOutputSanitized = this.outputObfuscator.obfuscate(taskOutput);
|
|
110
|
-
if (environment_1.NX_CLOUD_UNLIMITED_OUTPUT)
|
|
111
|
-
return taskOutputSanitized;
|
|
112
|
-
const maxCharacters = cacheStatus === 'cache-miss'
|
|
113
|
-
? code === 0
|
|
114
|
-
? CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK
|
|
115
|
-
: CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK
|
|
116
|
-
: CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK;
|
|
117
|
-
return taskOutputSanitized.length > maxCharacters
|
|
118
|
-
? `TRUNCATED\n\n${taskOutputSanitized.slice(taskOutputSanitized.length - maxCharacters)}`
|
|
119
|
-
: taskOutputSanitized;
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
return '';
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
cleanUpHashDetails(hashDetails) {
|
|
126
|
-
const nodes = {};
|
|
127
|
-
Object.keys(hashDetails.nodes)
|
|
128
|
-
.filter((k) => !k.startsWith('npm:'))
|
|
129
|
-
.forEach((k) => {
|
|
130
|
-
nodes[k] = hashDetails.nodes[k];
|
|
131
|
-
});
|
|
132
|
-
return {
|
|
133
|
-
nodes,
|
|
134
|
-
runtime: hashDetails.runtime,
|
|
135
|
-
implicitDeps: hashDetails.implicitDeps,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
readTerminalOutputFile(dir, hash) {
|
|
139
|
-
try {
|
|
140
|
-
return (0, fs_1.readFileSync)(path.join(dir, 'terminalOutputs', hash)).toString();
|
|
141
|
-
}
|
|
142
|
-
catch (_a) {
|
|
143
|
-
try {
|
|
144
|
-
return (0, fs_1.readFileSync)(path.join(dir, hash, 'terminalOutput')).toString();
|
|
145
|
-
}
|
|
146
|
-
catch (_b) {
|
|
147
|
-
return '';
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.CloudEnabledLifeCycle = CloudEnabledLifeCycle;
|
|
153
|
-
CloudEnabledLifeCycle.MAX_CHARACTERS_FAILED_TASK = 200000;
|
|
154
|
-
CloudEnabledLifeCycle.MAX_CHARACTERS_SUCCESSFUL_TASK = 20000;
|
|
155
|
-
CloudEnabledLifeCycle.MAX_CHARACTERS_CACHED_TASK = 20000;
|
|
156
|
-
//# sourceMappingURL=cloud-enabled-life-cycle.js.map
|
|
1
|
+
const a0_0x2a0a=['MAX_CHARACTERS_FAILED_TASK','../../../utilities/nx-imports','scheduledTasks','task','obfuscate','remote-cache-hit','statuses','length','local-cache-hit','outputObfuscator','endTask','find','status','tasks','cacheDirectory','runContext','keys','serializeOverrides','params','MAX_CHARACTERS_SUCCESSFUL_TASK','hashDetails','skipNxCache','cache','terminalOutput','taskId','cleanUpHashDetails','cache-miss','terminalOutputs','push','indexOf','CloudEnabledLifeCycle','endCommand','npm:','cacheStatus','hash','.cache','slice','join','project','startsWith','endTasks','toISOString','__esModule','cacheableOperations','remote-cache','TRUNCATED\x0a\x0a','path','target','updateStartedTask','readTerminalOutputFile','collectTerminalOutput','readFileSync','MAX_CHARACTERS_CACHED_TASK','forEach','Cannot\x20find\x20task\x20','nodes','../../../utilities/environment','local-cache','getTerminalOutput'];(function(_0x4038a2,_0x2a0a69){const _0x3be34f=function(_0x5dd5c7){while(--_0x5dd5c7){_0x4038a2['push'](_0x4038a2['shift']());}};_0x3be34f(++_0x2a0a69);}(a0_0x2a0a,0x172));const a0_0x3be3=function(_0x4038a2,_0x2a0a69){_0x4038a2=_0x4038a2-0x0;let _0x3be34f=a0_0x2a0a[_0x4038a2];return _0x3be34f;};'use strict';Object['defineProperty'](exports,a0_0x3be3('0x1a'),{'value':!![]});exports[a0_0x3be3('0xe')]=void 0x0;const path=require('path');const path_1=require(a0_0x3be3('0x1e'));const fs_1=require('fs');const environment_1=require(a0_0x3be3('0x28'));const serializer_overrides_1=require('../../../utilities/serializer-overrides');const {workspaceRoot}=require(a0_0x3be3('0x2c'));class CloudEnabledLifeCycle{constructor(_0x5713a1,_0x214784,_0x2fdc03,_0x447130,_0x5d2950,_0x1b4e39,_0x117335){this['runContext']=_0x5713a1;this['cacheDirectory']=_0x214784;this[a0_0x3be3('0x5')]=_0x2fdc03;this['collectTerminalOutput']=_0x447130;this[a0_0x3be3('0x1b')]=_0x5d2950;this[a0_0x3be3('0x34')]=_0x1b4e39;this[a0_0x3be3('0x38')]=_0x117335;}['scheduleTask'](_0x4cd760){this[a0_0x3be3('0x3a')][a0_0x3be3('0x2d')][a0_0x3be3('0xc')](_0x4cd760);}['startTask'](_0x23d8d0){this[a0_0x3be3('0x38')]['push']({'taskId':_0x23d8d0['id'],'startTime':new Date()[a0_0x3be3('0x19')](),'target':_0x23d8d0[a0_0x3be3('0x1f')][a0_0x3be3('0x1f')],'projectName':_0x23d8d0[a0_0x3be3('0x1f')][a0_0x3be3('0x16')],'hash':_0x23d8d0['hash'],'hashDetails':this[a0_0x3be3('0x9')](_0x23d8d0[a0_0x3be3('0x4')]),'params':(0x0,serializer_overrides_1[a0_0x3be3('0x1')])(_0x23d8d0)});}[a0_0x3be3('0x35')](_0xa36a7d,_0x45df29){let _0x3e2eda;if(this['runContext'][a0_0x3be3('0x31')][_0xa36a7d[a0_0x3be3('0x12')]]){_0x3e2eda=this[a0_0x3be3('0x3a')][a0_0x3be3('0x31')][_0xa36a7d[a0_0x3be3('0x12')]];}else{if(this[a0_0x3be3('0x1b')][a0_0x3be3('0xd')](_0xa36a7d['target'][a0_0x3be3('0x1f')])>-0x1&&!this['skipNxCache']){_0x3e2eda=a0_0x3be3('0x33');}else{_0x3e2eda=a0_0x3be3('0xa');}}this[a0_0x3be3('0x20')](_0xa36a7d,_0x45df29,_0x3e2eda);}[a0_0x3be3('0x18')](_0x5eda9e){for(let _0x13ec90 of _0x5eda9e){let _0x2c6f8a;const _0x1e44f7=_0x13ec90['status']===a0_0x3be3('0x1c');const _0x5286b8=_0x13ec90[a0_0x3be3('0x37')]===a0_0x3be3('0x6');const _0x4105cc=_0x13ec90[a0_0x3be3('0x37')]===a0_0x3be3('0x29')||_0x13ec90['status']==='local-cache-kept-existing'||_0x5286b8;if(this['runContext']['statuses'][_0x13ec90[a0_0x3be3('0x2e')][a0_0x3be3('0x12')]]){_0x2c6f8a=this[a0_0x3be3('0x3a')][a0_0x3be3('0x31')][_0x13ec90[a0_0x3be3('0x2e')][a0_0x3be3('0x12')]];}else if(_0x1e44f7){_0x2c6f8a=a0_0x3be3('0x30');}else if(_0x4105cc){_0x2c6f8a=a0_0x3be3('0x33');}else{if(this[a0_0x3be3('0x1b')]['indexOf'](_0x13ec90[a0_0x3be3('0x2e')][a0_0x3be3('0x1f')][a0_0x3be3('0x1f')])>-0x1&&!this['skipNxCache']){_0x2c6f8a='local-cache-hit';}else{_0x2c6f8a=a0_0x3be3('0xa');}}this[a0_0x3be3('0x20')](_0x13ec90[a0_0x3be3('0x2e')],_0x13ec90['code'],_0x2c6f8a);}}[a0_0x3be3('0xf')](){}[a0_0x3be3('0x20')](_0x4e3a06,_0x1c0743,_0x3374f8){const _0x103113=this[a0_0x3be3('0x38')][a0_0x3be3('0x36')](_0x255473=>_0x255473[a0_0x3be3('0x8')]===_0x4e3a06['id']);if(!_0x103113){throw new Error(a0_0x3be3('0x26')+_0x4e3a06['id']);}_0x103113['endTime']=new Date()['toISOString']();_0x103113[a0_0x3be3('0x37')]=_0x1c0743;_0x103113['params']=this['outputObfuscator'][a0_0x3be3('0x2f')](_0x103113[a0_0x3be3('0x2')]);_0x103113[a0_0x3be3('0x11')]=_0x3374f8;if(this[a0_0x3be3('0x22')]){_0x103113[a0_0x3be3('0x7')]=this[a0_0x3be3('0x2a')](_0x4e3a06[a0_0x3be3('0x12')],_0x103113[a0_0x3be3('0x11')],_0x1c0743);}}[a0_0x3be3('0x2a')](_0xdef40e,_0x107112,_0x2f7af8){let _0x55ee12;if(this['cacheDirectory']){if(this[a0_0x3be3('0x39')][a0_0x3be3('0x17')]('./')){_0x55ee12=(0x0,path_1['join'])(workspaceRoot,this['cacheDirectory']);}else{_0x55ee12=this['cacheDirectory'];}}else{_0x55ee12=(0x0,path_1[a0_0x3be3('0x15')])(workspaceRoot,'node_modules',a0_0x3be3('0x13'),'nx');}try{const _0x2cfedd=this[a0_0x3be3('0x21')](_0x55ee12,_0xdef40e);const _0x5c7018=this[a0_0x3be3('0x34')][a0_0x3be3('0x2f')](_0x2cfedd);if(environment_1['NX_CLOUD_UNLIMITED_OUTPUT'])return _0x5c7018;const _0x292bea=_0x107112===a0_0x3be3('0xa')?_0x2f7af8===0x0?CloudEnabledLifeCycle[a0_0x3be3('0x3')]:CloudEnabledLifeCycle['MAX_CHARACTERS_FAILED_TASK']:CloudEnabledLifeCycle[a0_0x3be3('0x24')];return _0x5c7018[a0_0x3be3('0x32')]>_0x292bea?a0_0x3be3('0x1d')+_0x5c7018[a0_0x3be3('0x14')](_0x5c7018['length']-_0x292bea):_0x5c7018;}catch(_0x1a5fd5){return'';}}[a0_0x3be3('0x9')](_0x34940d){const _0x58b0ba={};Object[a0_0x3be3('0x0')](_0x34940d[a0_0x3be3('0x27')])['filter'](_0x3d8f76=>!_0x3d8f76['startsWith'](a0_0x3be3('0x10')))[a0_0x3be3('0x25')](_0x1c7906=>{_0x58b0ba[_0x1c7906]=_0x34940d[a0_0x3be3('0x27')][_0x1c7906];});return{'nodes':_0x58b0ba,'runtime':_0x34940d['runtime'],'implicitDeps':_0x34940d['implicitDeps']};}[a0_0x3be3('0x21')](_0x4d206b,_0x38f5ee){try{return(0x0,fs_1[a0_0x3be3('0x23')])(path[a0_0x3be3('0x15')](_0x4d206b,a0_0x3be3('0xb'),_0x38f5ee))['toString']();}catch(_0x1bd862){try{return(0x0,fs_1[a0_0x3be3('0x23')])(path[a0_0x3be3('0x15')](_0x4d206b,_0x38f5ee,a0_0x3be3('0x7')))['toString']();}catch(_0xef3d47){return'';}}}}exports[a0_0x3be3('0xe')]=CloudEnabledLifeCycle;CloudEnabledLifeCycle[a0_0x3be3('0x2b')]=0x30d40;CloudEnabledLifeCycle[a0_0x3be3('0x3')]=0x4e20;CloudEnabledLifeCycle[a0_0x3be3('0x24')]=0x4e20;
|
|
@@ -1,284 +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.cloudEnabledTasksRunner = void 0;
|
|
13
|
-
const message_reporter_1 = require("../../terminal-output/message-reporter");
|
|
14
|
-
const end_of_run_message_1 = require("../../terminal-output/end-of-run-message");
|
|
15
|
-
const output_obfuscator_1 = require("../../terminal-output/output-obfuscator");
|
|
16
|
-
const cloud_enabled_life_cycle_1 = require("./cloud-enabled-life-cycle");
|
|
17
|
-
const file_storage_1 = require("../../file-storage/file-storage");
|
|
18
|
-
const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
|
|
19
|
-
const environment_1 = require("../../../utilities/environment");
|
|
20
|
-
const cloud_remote_cache_1 = require("./cloud-remote-cache");
|
|
21
|
-
const cloud_run_api_1 = require("./cloud-run.api");
|
|
22
|
-
const fs_1 = require("fs");
|
|
23
|
-
const path = require("path");
|
|
24
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
25
|
-
const error_reporter_api_1 = require("../../api/error-reporter.api");
|
|
26
|
-
const path_1 = require("path");
|
|
27
|
-
const fs_extra_1 = require("fs-extra");
|
|
28
|
-
const id_generator_1 = require("./id-generator");
|
|
29
|
-
const { tasksRunner, output, Cache } = require('../../../utilities/nx-imports');
|
|
30
|
-
function createApi(errors, options, runContext) {
|
|
31
|
-
const machineInfo = (0, environment_1.getMachineInfo)(options);
|
|
32
|
-
return new cloud_run_api_1.CloudRunApi(errors, runContext, options, machineInfo);
|
|
33
|
-
}
|
|
34
|
-
function storeTaskHashes(taskExecutions, directory, distributedExecutionId) {
|
|
35
|
-
const hashes = JSON.stringify(taskExecutions.map((t) => ({
|
|
36
|
-
taskId: t.taskId,
|
|
37
|
-
hash: t.hash,
|
|
38
|
-
})));
|
|
39
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
40
|
-
output.note({
|
|
41
|
-
title: `Executed tasks with hashes: ${hashes}`,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
(0, fs_1.writeFileSync)(path.join(directory, `tasks-hashes-${distributedExecutionId}`), hashes);
|
|
45
|
-
}
|
|
46
|
-
function onComplete({ daemon, lifeCycle, options, remoteCache, api, outputObfuscator, runStartTime, messages, endOfRunMessage, taskExecutions, versionOfNxBefore133, inner, encryptionKey, fileStorage, uploadInCurrentProcess, runContext, }) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const runEndTime = new Date().toISOString();
|
|
49
|
-
const branch = (0, environment_1.getBranch)();
|
|
50
|
-
const runData = {
|
|
51
|
-
command: outputObfuscator.obfuscate((0, environment_1.parseCommand)()),
|
|
52
|
-
startTime: runStartTime,
|
|
53
|
-
endTime: runEndTime,
|
|
54
|
-
distributedExecutionId: environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID,
|
|
55
|
-
branch: branch,
|
|
56
|
-
scan: true,
|
|
57
|
-
runGroup: (0, environment_1.getRunGroup)(),
|
|
58
|
-
// only set sha if branch is set because we invoke a separate process,
|
|
59
|
-
// which adds a few millis
|
|
60
|
-
sha: branch ? (0, environment_1.extractGitSha)() : undefined,
|
|
61
|
-
inner: inner,
|
|
62
|
-
};
|
|
63
|
-
if (uploadInCurrentProcess) {
|
|
64
|
-
storeTaskHashes(taskExecutions, options.cacheDirectory || './node_modules/.cache/nx', environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID);
|
|
65
|
-
try {
|
|
66
|
-
yield remoteCache.waitForStoreRequestsToComplete();
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
output.error({
|
|
70
|
-
title: `Nx Cloud wasn't able to store artifacts.`,
|
|
71
|
-
});
|
|
72
|
-
messages.printMessages();
|
|
73
|
-
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
yield api.endRun(runData, taskExecutions);
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
output.error({
|
|
80
|
-
title: `Nx Cloud wasn't able to record its run.`,
|
|
81
|
-
});
|
|
82
|
-
messages.printMessages();
|
|
83
|
-
process.exit(environment_1.DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE);
|
|
84
|
-
}
|
|
85
|
-
yield (0, metric_logger_1.submitRunMetrics)(options);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
try {
|
|
89
|
-
const accessToken = environment_1.ACCESS_TOKEN ? environment_1.ACCESS_TOKEN : options.accessToken;
|
|
90
|
-
const linkId = (0, id_generator_1.generateUniqueLinkId)();
|
|
91
|
-
yield daemon.processInBackground('@nrwl/nx-cloud/lib/daemon/process-run-end', {
|
|
92
|
-
encryptionKey,
|
|
93
|
-
runnerOptions: Object.assign(Object.assign({}, options), { accessToken }),
|
|
94
|
-
uploads: fileStorage.uploads,
|
|
95
|
-
runEnd: {
|
|
96
|
-
runData,
|
|
97
|
-
taskExecutions,
|
|
98
|
-
linkId,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
runContext.runUrl = `${options.url || 'https://api.nrwl.io'}/runs/${linkId}`;
|
|
102
|
-
}
|
|
103
|
-
catch (e) {
|
|
104
|
-
output.warn({
|
|
105
|
-
title: `Nx Cloud Problems`,
|
|
106
|
-
bodyLines: [e.message || e.toString()],
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
// this workaround is required because prior to Nx 13.3 we printed
|
|
110
|
-
// the end message after the runner completes, so we need to wait for the
|
|
111
|
-
// message to appear in the right place
|
|
112
|
-
if (versionOfNxBefore133) {
|
|
113
|
-
setTimeout(() => {
|
|
114
|
-
messages.printMessages();
|
|
115
|
-
if (!messages.anyErrors && !inner) {
|
|
116
|
-
endOfRunMessage.printCacheHitsMessage();
|
|
117
|
-
}
|
|
118
|
-
}, 0);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
messages.printMessages();
|
|
122
|
-
if (!messages.anyErrors && !inner) {
|
|
123
|
-
endOfRunMessage.printCacheHitsMessage();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function createLifeCycle(runContext, options, outputObfuscator, tasks) {
|
|
130
|
-
const cloudEnabledLifeCycle = new cloud_enabled_life_cycle_1.CloudEnabledLifeCycle(runContext, options.cacheDirectory, !!options.skipNxCache, options.scan === undefined ? true : options.scan, options.cacheableOperations || [], outputObfuscator, tasks);
|
|
131
|
-
try {
|
|
132
|
-
const { CompositeLifeCycle } = require('../../../utilities/nx-imports');
|
|
133
|
-
if (!CompositeLifeCycle)
|
|
134
|
-
return cloudEnabledLifeCycle;
|
|
135
|
-
return new CompositeLifeCycle([options.lifeCycle, cloudEnabledLifeCycle]);
|
|
136
|
-
}
|
|
137
|
-
catch (e) {
|
|
138
|
-
return cloudEnabledLifeCycle;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
function fetchUrlsForKnownHashesUpfront(api, runContext, tasks, options) {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
let hashes = tasks.map((t) => t.hash).filter((h) => !!h);
|
|
144
|
-
const c = new Cache(options);
|
|
145
|
-
if (!options.skipNxCache) {
|
|
146
|
-
// filter out the urls that don't have artifact stored locally
|
|
147
|
-
const promises = yield Promise.all(hashes.map((hash) => {
|
|
148
|
-
const tdCommit = (0, path_1.join)(c.cachePath, `${hash}.commit`);
|
|
149
|
-
return (0, fs_extra_1.pathExists)(tdCommit);
|
|
150
|
-
}));
|
|
151
|
-
const missingHashes = [];
|
|
152
|
-
for (let i = 0; i < promises.length; ++i) {
|
|
153
|
-
if (promises[i]) {
|
|
154
|
-
missingHashes.push(hashes[i]);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
hashes = missingHashes;
|
|
158
|
-
}
|
|
159
|
-
if (hashes.length > 0) {
|
|
160
|
-
const startRunRequest = api.startRun(environment_1.NX_CLOUD_DISTRIBUTED_EXECUTION_ID, hashes);
|
|
161
|
-
for (const hash of hashes) {
|
|
162
|
-
runContext.requests[hash] = startRunRequest;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function isConnectedToPrivateCloud(options) {
|
|
168
|
-
if (!options.url)
|
|
169
|
-
return false;
|
|
170
|
-
if (options.url.endsWith('.nx.app'))
|
|
171
|
-
return false;
|
|
172
|
-
if (options.url.indexOf('localhost') > -1)
|
|
173
|
-
return false;
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
function cloudEnabledTasksRunner(tasks, options, context, inner = false) {
|
|
177
|
-
var _a;
|
|
178
|
-
const runContext = {
|
|
179
|
-
statuses: {},
|
|
180
|
-
scheduledTasks: [],
|
|
181
|
-
requests: {},
|
|
182
|
-
allTasks: tasks,
|
|
183
|
-
};
|
|
184
|
-
const versionOfNxBefore133 = options.lifeCycle === undefined;
|
|
185
|
-
const taskExecutions = [];
|
|
186
|
-
const messages = new message_reporter_1.MessageReporter(options);
|
|
187
|
-
const api = createApi(messages, options, runContext);
|
|
188
|
-
const endOfRunMessage = new end_of_run_message_1.EndOfRunMessage(runContext, taskExecutions);
|
|
189
|
-
const outputObfuscator = new output_obfuscator_1.OutputObfuscator(options.maskedProperties);
|
|
190
|
-
const runStartTime = new Date().toISOString();
|
|
191
|
-
const lifeCycle = createLifeCycle(runContext, options, outputObfuscator, taskExecutions);
|
|
192
|
-
const encryptionKey = environment_1.ENCRYPTION_KEY || options.encryptionKey;
|
|
193
|
-
const encryption = new e2e_encryption_1.E2EEncryption(encryptionKey);
|
|
194
|
-
const errorApi = new error_reporter_api_1.ErrorReporterApi(options);
|
|
195
|
-
const uploadInCurrentProcess = !!environment_1.AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION ||
|
|
196
|
-
!((_a = context.daemon) === null || _a === void 0 ? void 0 : _a.enabled()) ||
|
|
197
|
-
isConnectedToPrivateCloud(options);
|
|
198
|
-
const fileStorage = new file_storage_1.FileStorage(encryption, errorApi, false, uploadInCurrentProcess);
|
|
199
|
-
const remoteCache = new cloud_remote_cache_1.CloudRemoteCache(messages, api, runContext, fileStorage);
|
|
200
|
-
// we don't await for it cause this step is optional
|
|
201
|
-
fetchUrlsForKnownHashesUpfront(api, runContext, tasks, options);
|
|
202
|
-
// have to reset it so we don't capture inner tasks
|
|
203
|
-
delete process.env.NX_CLOUD_DISTRIBUTED_EXECUTION_ID;
|
|
204
|
-
const res = tasksRunner(tasks, Object.assign(Object.assign({}, options), { remoteCache, lifeCycle }), context);
|
|
205
|
-
// observable -> legacy
|
|
206
|
-
if (res.subscribe) {
|
|
207
|
-
const { Subject } = require('rxjs/internal/Subject');
|
|
208
|
-
const wrappedRes = new Subject();
|
|
209
|
-
res.subscribe({
|
|
210
|
-
next: (value) => wrappedRes.next(value),
|
|
211
|
-
error: (err) => wrappedRes.error(err),
|
|
212
|
-
complete: () => __awaiter(this, void 0, void 0, function* () {
|
|
213
|
-
yield onComplete({
|
|
214
|
-
daemon: context.daemon,
|
|
215
|
-
lifeCycle,
|
|
216
|
-
options,
|
|
217
|
-
remoteCache,
|
|
218
|
-
api,
|
|
219
|
-
outputObfuscator,
|
|
220
|
-
runStartTime,
|
|
221
|
-
messages,
|
|
222
|
-
endOfRunMessage,
|
|
223
|
-
taskExecutions,
|
|
224
|
-
versionOfNxBefore133,
|
|
225
|
-
inner,
|
|
226
|
-
encryptionKey,
|
|
227
|
-
fileStorage,
|
|
228
|
-
uploadInCurrentProcess,
|
|
229
|
-
runContext,
|
|
230
|
-
});
|
|
231
|
-
wrappedRes.complete();
|
|
232
|
-
}),
|
|
233
|
-
});
|
|
234
|
-
return wrappedRes;
|
|
235
|
-
// promise
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
return res
|
|
239
|
-
.then((r) => __awaiter(this, void 0, void 0, function* () {
|
|
240
|
-
yield onComplete({
|
|
241
|
-
daemon: context.daemon,
|
|
242
|
-
lifeCycle,
|
|
243
|
-
options,
|
|
244
|
-
remoteCache,
|
|
245
|
-
api,
|
|
246
|
-
outputObfuscator,
|
|
247
|
-
runStartTime,
|
|
248
|
-
messages,
|
|
249
|
-
endOfRunMessage,
|
|
250
|
-
taskExecutions,
|
|
251
|
-
versionOfNxBefore133,
|
|
252
|
-
inner,
|
|
253
|
-
encryptionKey,
|
|
254
|
-
fileStorage,
|
|
255
|
-
uploadInCurrentProcess,
|
|
256
|
-
runContext,
|
|
257
|
-
});
|
|
258
|
-
return r;
|
|
259
|
-
}))
|
|
260
|
-
.catch((e) => __awaiter(this, void 0, void 0, function* () {
|
|
261
|
-
yield onComplete({
|
|
262
|
-
daemon: context.daemon,
|
|
263
|
-
lifeCycle,
|
|
264
|
-
options,
|
|
265
|
-
remoteCache,
|
|
266
|
-
api,
|
|
267
|
-
outputObfuscator,
|
|
268
|
-
runStartTime,
|
|
269
|
-
messages,
|
|
270
|
-
endOfRunMessage,
|
|
271
|
-
taskExecutions,
|
|
272
|
-
versionOfNxBefore133,
|
|
273
|
-
inner,
|
|
274
|
-
encryptionKey,
|
|
275
|
-
fileStorage,
|
|
276
|
-
uploadInCurrentProcess,
|
|
277
|
-
runContext,
|
|
278
|
-
});
|
|
279
|
-
throw e;
|
|
280
|
-
}));
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
exports.cloudEnabledTasksRunner = cloudEnabledTasksRunner;
|
|
284
|
-
//# sourceMappingURL=cloud-enabled.runner.js.map
|
|
1
|
+
const a1_0x1a36=['enabled','.nx.app','warn','../../../utilities/nx-imports','getBranch','error','MessageReporter','startRun','processInBackground','defineProperty','../../terminal-output/end-of-run-message','uploads','getRunGroup','./cloud-run.api','generateUniqueLinkId','./cloud-enabled-life-cycle','maskedProperties','requests','complete','indexOf','NX_CLOUD_DISTRIBUTED_EXECUTION_ID','taskId','url','daemon','../../../utilities/environment','__awaiter','../../file-storage/file-storage','writeFileSync','then','printCacheHitsMessage','pathExists','waitForStoreRequestsToComplete','join','printMessages','./node_modules/.cache/nx','filter','cacheDirectory','all','./cloud-remote-cache','getMachineInfo','cloudEnabledTasksRunner','accessToken','parseCommand','length','done','../../../utilities/metric-logger','../../terminal-output/output-obfuscator','lifeCycle','runUrl','map','obfuscate','../../api/error-reporter.api','DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE','ACCESS_TOKEN','note','FileStorage','localhost','AGENT_RUNNING_IN_DISTRIBUTED_EXECUTION','./id-generator','toISOString','EndOfRunMessage','next','subscribe','anyErrors','scan','Nx\x20Cloud\x20Problems','CloudRunApi','value','cacheableOperations','CloudEnabledLifeCycle','VERBOSE_LOGGING','path','exit','assign','.commit','encryptionKey','endRun','OutputObfuscator','__esModule','apply','ErrorReporterApi','throw','skipNxCache','hash','@nrwl/nx-cloud/lib/daemon/process-run-end','E2EEncryption','Executed\x20tasks\x20with\x20hashes:\x20','stringify'];(function(_0x3b4b85,_0x1a366a){const _0x325643=function(_0x2f88b3){while(--_0x2f88b3){_0x3b4b85['push'](_0x3b4b85['shift']());}};_0x325643(++_0x1a366a);}(a1_0x1a36,0x15d));const a1_0x3256=function(_0x3b4b85,_0x1a366a){_0x3b4b85=_0x3b4b85-0x0;let _0x325643=a1_0x1a36[_0x3b4b85];return _0x325643;};'use strict';var __awaiter=this&&this[a1_0x3256('0x1c')]||function(_0x400239,_0x586f42,_0x4c692b,_0xd8fbdd){function _0x3d76fe(_0x5acdfc){return _0x5acdfc instanceof _0x4c692b?_0x5acdfc:new _0x4c692b(function(_0x2dc28a){_0x2dc28a(_0x5acdfc);});}return new(_0x4c692b||(_0x4c692b=Promise))(function(_0x32e361,_0xefdfe){function _0x1e8f25(_0x38c6ab){try{_0x3dc417(_0xd8fbdd['next'](_0x38c6ab));}catch(_0x3cdd75){_0xefdfe(_0x3cdd75);}}function _0x2fe103(_0x254017){try{_0x3dc417(_0xd8fbdd[a1_0x3256('0x54')](_0x254017));}catch(_0x2cf699){_0xefdfe(_0x2cf699);}}function _0x3dc417(_0x3f5722){_0x3f5722[a1_0x3256('0x2f')]?_0x32e361(_0x3f5722[a1_0x3256('0x46')]):_0x3d76fe(_0x3f5722[a1_0x3256('0x46')])[a1_0x3256('0x1f')](_0x1e8f25,_0x2fe103);}_0x3dc417((_0xd8fbdd=_0xd8fbdd[a1_0x3256('0x52')](_0x400239,_0x586f42||[]))[a1_0x3256('0x40')]());});};Object[a1_0x3256('0xc')](exports,a1_0x3256('0x51'),{'value':!![]});exports['cloudEnabledTasksRunner']=void 0x0;const message_reporter_1=require('../../terminal-output/message-reporter');const end_of_run_message_1=require(a1_0x3256('0xd'));const output_obfuscator_1=require(a1_0x3256('0x31'));const cloud_enabled_life_cycle_1=require(a1_0x3256('0x12'));const file_storage_1=require(a1_0x3256('0x1d'));const e2e_encryption_1=require('../../file-storage/e2e-encryption');const environment_1=require(a1_0x3256('0x1b'));const cloud_remote_cache_1=require(a1_0x3256('0x29'));const cloud_run_api_1=require(a1_0x3256('0x10'));const fs_1=require('fs');const path=require(a1_0x3256('0x4a'));const metric_logger_1=require(a1_0x3256('0x30'));const error_reporter_api_1=require(a1_0x3256('0x36'));const path_1=require(a1_0x3256('0x4a'));const fs_extra_1=require('fs-extra');const id_generator_1=require(a1_0x3256('0x3d'));const {tasksRunner,output,Cache}=require(a1_0x3256('0x6'));function createApi(_0x39b4c1,_0x30fc54,_0x3bedc2){const _0x764d85=(0x0,environment_1[a1_0x3256('0x2a')])(_0x30fc54);return new cloud_run_api_1[(a1_0x3256('0x45'))](_0x39b4c1,_0x3bedc2,_0x30fc54,_0x764d85);}function storeTaskHashes(_0x1f652f,_0x247e0e,_0x583202){const _0x41e62e=JSON[a1_0x3256('0x2')](_0x1f652f[a1_0x3256('0x34')](_0x18ea29=>({'taskId':_0x18ea29[a1_0x3256('0x18')],'hash':_0x18ea29['hash']})));if(environment_1[a1_0x3256('0x49')]){output[a1_0x3256('0x39')]({'title':a1_0x3256('0x1')+_0x41e62e});}(0x0,fs_1[a1_0x3256('0x1e')])(path[a1_0x3256('0x23')](_0x247e0e,'tasks-hashes-'+_0x583202),_0x41e62e);}function onComplete({daemon,lifeCycle,options,remoteCache,api,outputObfuscator,runStartTime,messages,endOfRunMessage,taskExecutions,versionOfNxBefore133,inner,encryptionKey,fileStorage,uploadInCurrentProcess,runContext}){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x4e0fa8=new Date()[a1_0x3256('0x3e')]();const _0x4502c1=(0x0,environment_1[a1_0x3256('0x7')])();const _0x2072b1={'command':outputObfuscator[a1_0x3256('0x35')]((0x0,environment_1[a1_0x3256('0x2d')])()),'startTime':runStartTime,'endTime':_0x4e0fa8,'distributedExecutionId':environment_1['NX_CLOUD_DISTRIBUTED_EXECUTION_ID'],'branch':_0x4502c1,'scan':!![],'runGroup':(0x0,environment_1[a1_0x3256('0xf')])(),'sha':_0x4502c1?(0x0,environment_1['extractGitSha'])():undefined,'inner':inner};if(uploadInCurrentProcess){storeTaskHashes(taskExecutions,options['cacheDirectory']||a1_0x3256('0x25'),environment_1[a1_0x3256('0x17')]);try{yield remoteCache[a1_0x3256('0x22')]();}catch(_0x44c248){output[a1_0x3256('0x8')]({'title':'Nx\x20Cloud\x20wasn\x27t\x20able\x20to\x20store\x20artifacts.'});messages[a1_0x3256('0x24')]();process['exit'](environment_1[a1_0x3256('0x37')]);}try{yield api[a1_0x3256('0x4f')](_0x2072b1,taskExecutions);}catch(_0x2e074a){output['error']({'title':'Nx\x20Cloud\x20wasn\x27t\x20able\x20to\x20record\x20its\x20run.'});messages[a1_0x3256('0x24')]();process[a1_0x3256('0x4b')](environment_1['DISTRIBUTED_TASK_EXECUTION_INTERNAL_ERROR_STATUS_CODE']);}yield(0x0,metric_logger_1['submitRunMetrics'])(options);}else{try{const _0x5c514b=environment_1[a1_0x3256('0x38')]?environment_1[a1_0x3256('0x38')]:options[a1_0x3256('0x2c')];const _0x45b76d=(0x0,id_generator_1[a1_0x3256('0x11')])();yield daemon[a1_0x3256('0xb')](a1_0x3256('0x57'),{'encryptionKey':encryptionKey,'runnerOptions':Object['assign'](Object[a1_0x3256('0x4c')]({},options),{'accessToken':_0x5c514b}),'uploads':fileStorage[a1_0x3256('0xe')],'runEnd':{'runData':_0x2072b1,'taskExecutions':taskExecutions,'linkId':_0x45b76d}});runContext[a1_0x3256('0x33')]=(options[a1_0x3256('0x19')]||'https://api.nrwl.io')+'/runs/'+_0x45b76d;}catch(_0x43c148){output[a1_0x3256('0x5')]({'title':a1_0x3256('0x44'),'bodyLines':[_0x43c148['message']||_0x43c148['toString']()]});}if(versionOfNxBefore133){setTimeout(()=>{messages[a1_0x3256('0x24')]();if(!messages[a1_0x3256('0x42')]&&!inner){endOfRunMessage[a1_0x3256('0x20')]();}},0x0);}else{messages['printMessages']();if(!messages[a1_0x3256('0x42')]&&!inner){endOfRunMessage['printCacheHitsMessage']();}}}});}function createLifeCycle(_0xf7b5af,_0x38d993,_0x39953f,_0x5f4597){const _0x1648a3=new cloud_enabled_life_cycle_1[(a1_0x3256('0x48'))](_0xf7b5af,_0x38d993[a1_0x3256('0x27')],!!_0x38d993[a1_0x3256('0x55')],_0x38d993[a1_0x3256('0x43')]===undefined?!![]:_0x38d993[a1_0x3256('0x43')],_0x38d993[a1_0x3256('0x47')]||[],_0x39953f,_0x5f4597);try{const {CompositeLifeCycle}=require(a1_0x3256('0x6'));if(!CompositeLifeCycle)return _0x1648a3;return new CompositeLifeCycle([_0x38d993[a1_0x3256('0x32')],_0x1648a3]);}catch(_0x275f5e){return _0x1648a3;}}function fetchUrlsForKnownHashesUpfront(_0x3cd368,_0x58dbd6,_0x1b152a,_0x22986c){return __awaiter(this,void 0x0,void 0x0,function*(){let _0x54f9ae=_0x1b152a[a1_0x3256('0x34')](_0x4bfb4b=>_0x4bfb4b[a1_0x3256('0x56')])[a1_0x3256('0x26')](_0x344f61=>!!_0x344f61);const _0x507965=new Cache(_0x22986c);if(!_0x22986c[a1_0x3256('0x55')]){const _0x3ebfb1=yield Promise[a1_0x3256('0x28')](_0x54f9ae[a1_0x3256('0x34')](_0x459dec=>{const _0x25d5ca=(0x0,path_1['join'])(_0x507965['cachePath'],_0x459dec+a1_0x3256('0x4d'));return(0x0,fs_extra_1[a1_0x3256('0x21')])(_0x25d5ca);}));const _0x51a191=[];for(let _0x409d77=0x0;_0x409d77<_0x3ebfb1['length'];++_0x409d77){if(_0x3ebfb1[_0x409d77]){_0x51a191['push'](_0x54f9ae[_0x409d77]);}}_0x54f9ae=_0x51a191;}if(_0x54f9ae[a1_0x3256('0x2e')]>0x0){const _0x2a3b35=_0x3cd368[a1_0x3256('0xa')](environment_1[a1_0x3256('0x17')],_0x54f9ae);for(const _0x1b6654 of _0x54f9ae){_0x58dbd6[a1_0x3256('0x14')][_0x1b6654]=_0x2a3b35;}}});}function isConnectedToPrivateCloud(_0x5e8a8b){if(!_0x5e8a8b[a1_0x3256('0x19')])return![];if(_0x5e8a8b['url']['endsWith'](a1_0x3256('0x4')))return![];if(_0x5e8a8b['url'][a1_0x3256('0x16')](a1_0x3256('0x3b'))>-0x1)return![];return!![];}function cloudEnabledTasksRunner(_0x9b14b4,_0xc44a80,_0x1b72f2,_0x2dcbd8=![]){var _0x32bc46;const _0x1ef9e0={'statuses':{},'scheduledTasks':[],'requests':{},'allTasks':_0x9b14b4};const _0x57ec81=_0xc44a80['lifeCycle']===undefined;const _0x5115ae=[];const _0x273158=new message_reporter_1[(a1_0x3256('0x9'))](_0xc44a80);const _0xd6842d=createApi(_0x273158,_0xc44a80,_0x1ef9e0);const _0x2a3185=new end_of_run_message_1[(a1_0x3256('0x3f'))](_0x1ef9e0,_0x5115ae);const _0x1213ae=new output_obfuscator_1[(a1_0x3256('0x50'))](_0xc44a80[a1_0x3256('0x13')]);const _0xd964c8=new Date()[a1_0x3256('0x3e')]();const _0x235465=createLifeCycle(_0x1ef9e0,_0xc44a80,_0x1213ae,_0x5115ae);const _0x349b13=environment_1['ENCRYPTION_KEY']||_0xc44a80[a1_0x3256('0x4e')];const _0x467037=new e2e_encryption_1[(a1_0x3256('0x0'))](_0x349b13);const _0x5a3196=new error_reporter_api_1[(a1_0x3256('0x53'))](_0xc44a80);const _0x5ce186=!!environment_1[a1_0x3256('0x3c')]||!((_0x32bc46=_0x1b72f2[a1_0x3256('0x1a')])===null||_0x32bc46===void 0x0?void 0x0:_0x32bc46[a1_0x3256('0x3')]())||isConnectedToPrivateCloud(_0xc44a80);const _0x48d945=new file_storage_1[(a1_0x3256('0x3a'))](_0x467037,_0x5a3196,![],_0x5ce186);const _0x38fa77=new cloud_remote_cache_1['CloudRemoteCache'](_0x273158,_0xd6842d,_0x1ef9e0,_0x48d945);fetchUrlsForKnownHashesUpfront(_0xd6842d,_0x1ef9e0,_0x9b14b4,_0xc44a80);delete process['env'][a1_0x3256('0x17')];const _0x5dd4ec=tasksRunner(_0x9b14b4,Object[a1_0x3256('0x4c')](Object[a1_0x3256('0x4c')]({},_0xc44a80),{'remoteCache':_0x38fa77,'lifeCycle':_0x235465}),_0x1b72f2);if(_0x5dd4ec[a1_0x3256('0x41')]){const {Subject}=require('rxjs/internal/Subject');const _0x5c533a=new Subject();_0x5dd4ec[a1_0x3256('0x41')]({'next':_0x1b6cf7=>_0x5c533a[a1_0x3256('0x40')](_0x1b6cf7),'error':_0x34a0f9=>_0x5c533a[a1_0x3256('0x8')](_0x34a0f9),'complete':()=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete({'daemon':_0x1b72f2[a1_0x3256('0x1a')],'lifeCycle':_0x235465,'options':_0xc44a80,'remoteCache':_0x38fa77,'api':_0xd6842d,'outputObfuscator':_0x1213ae,'runStartTime':_0xd964c8,'messages':_0x273158,'endOfRunMessage':_0x2a3185,'taskExecutions':_0x5115ae,'versionOfNxBefore133':_0x57ec81,'inner':_0x2dcbd8,'encryptionKey':_0x349b13,'fileStorage':_0x48d945,'uploadInCurrentProcess':_0x5ce186,'runContext':_0x1ef9e0});_0x5c533a[a1_0x3256('0x15')]();})});return _0x5c533a;}else{return _0x5dd4ec[a1_0x3256('0x1f')](_0x10b310=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete({'daemon':_0x1b72f2[a1_0x3256('0x1a')],'lifeCycle':_0x235465,'options':_0xc44a80,'remoteCache':_0x38fa77,'api':_0xd6842d,'outputObfuscator':_0x1213ae,'runStartTime':_0xd964c8,'messages':_0x273158,'endOfRunMessage':_0x2a3185,'taskExecutions':_0x5115ae,'versionOfNxBefore133':_0x57ec81,'inner':_0x2dcbd8,'encryptionKey':_0x349b13,'fileStorage':_0x48d945,'uploadInCurrentProcess':_0x5ce186,'runContext':_0x1ef9e0});return _0x10b310;}))['catch'](_0x550a52=>__awaiter(this,void 0x0,void 0x0,function*(){yield onComplete({'daemon':_0x1b72f2[a1_0x3256('0x1a')],'lifeCycle':_0x235465,'options':_0xc44a80,'remoteCache':_0x38fa77,'api':_0xd6842d,'outputObfuscator':_0x1213ae,'runStartTime':_0xd964c8,'messages':_0x273158,'endOfRunMessage':_0x2a3185,'taskExecutions':_0x5115ae,'versionOfNxBefore133':_0x57ec81,'inner':_0x2dcbd8,'encryptionKey':_0x349b13,'fileStorage':_0x48d945,'uploadInCurrentProcess':_0x5ce186,'runContext':_0x1ef9e0});throw _0x550a52;}));}}exports[a1_0x3256('0x2b')]=cloudEnabledTasksRunner;
|