@nrwl/nx-cloud 15.3.1-beta.1 → 15.3.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/lib/core/api/error-reporter.api.js +1 -36
- package/lib/core/api/run-group.api.js +1 -73
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +1 -93
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +1 -320
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +1 -133
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +1 -168
- package/lib/core/runners/cloud-enabled/id-generator.js +1 -16
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +1 -93
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +1 -157
- package/lib/core/runners/distributed-agent/execute-tasks.js +1 -114
- package/lib/core/runners/distributed-agent/invoke-tasks-using-nx-imperative-api.js +1 -58
- package/lib/core/runners/distributed-agent/invoke-tasks-using-run-many.js +1 -97
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +1 -152
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +1 -118
- package/lib/core/runners/distributed-execution/process-task.js +1 -45
- package/lib/core/runners/distributed-execution/process-tasks.js +1 -67
- 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 -100
- package/package.json +1 -1
|
@@ -1,133 +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.CloudRemoteCache = void 0;
|
|
13
|
-
const environment_1 = require("../../../utilities/environment");
|
|
14
|
-
const { output } = require('../../../utilities/nx-imports');
|
|
15
|
-
class CloudRemoteCache {
|
|
16
|
-
constructor(messages, api, runContext, fileStorage, distributedExecutionId, storeInCurrentProcess) {
|
|
17
|
-
this.messages = messages;
|
|
18
|
-
this.api = api;
|
|
19
|
-
this.runContext = runContext;
|
|
20
|
-
this.fileStorage = fileStorage;
|
|
21
|
-
this.distributedExecutionId = distributedExecutionId;
|
|
22
|
-
this.storeInCurrentProcess = storeInCurrentProcess;
|
|
23
|
-
this.storeRequests = [];
|
|
24
|
-
this.delayedStoreRequests = [];
|
|
25
|
-
}
|
|
26
|
-
retrieve(hash, cacheDirectory) {
|
|
27
|
-
var _a;
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
if (this.messages.cacheError)
|
|
30
|
-
return false;
|
|
31
|
-
const hashUrls = yield this.hashUrls(hash);
|
|
32
|
-
if (!hashUrls || !hashUrls.get) {
|
|
33
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
34
|
-
output.note({ title: `Nx Cloud: Cache miss ${hash}.` });
|
|
35
|
-
}
|
|
36
|
-
this.runContext.statuses[hash] = 'cache-miss';
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
try {
|
|
40
|
-
yield this.fileStorage.retrieve(hash, hashUrls.get, cacheDirectory);
|
|
41
|
-
this.runContext.statuses[hash] = 'remote-cache-hit';
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
catch (ee) {
|
|
45
|
-
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
|
|
46
|
-
// TODO: vsavkin remove this handling Oct 2023
|
|
47
|
-
// 404 indicates that something is broken, but older versions
|
|
48
|
-
// of the api can result in such errors
|
|
49
|
-
// we ignore them for now
|
|
50
|
-
if (e.response && e.response.status === 404) {
|
|
51
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
52
|
-
output.note({ title: `Nx Cloud: Cache miss ${hash}. Status 404.` });
|
|
53
|
-
}
|
|
54
|
-
// cache miss. print nothing
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
|
|
58
|
-
}
|
|
59
|
-
this.runContext.statuses[hash] = 'cache-miss';
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
store(hash, cacheDirectory) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
if (this.messages.cacheError)
|
|
67
|
-
return false;
|
|
68
|
-
const res = Promise.resolve().then(() => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
var _a;
|
|
70
|
-
const hashUrls = yield this.hashUrls(hash);
|
|
71
|
-
if (!hashUrls)
|
|
72
|
-
return false;
|
|
73
|
-
if (!hashUrls.put) {
|
|
74
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
75
|
-
output.note({
|
|
76
|
-
title: `Nx Cloud: Skipping storing ${hash}.`,
|
|
77
|
-
bodyLines: [
|
|
78
|
-
`There are several reasons why this can happen.`,
|
|
79
|
-
`Maybe you are using a read-only token or the artifact has already being uploaded.`,
|
|
80
|
-
],
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
if (!this.storeInCurrentProcess) {
|
|
86
|
-
this.delayedStoreRequests.push({ hash: hash, url: hashUrls.put });
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
try {
|
|
90
|
-
yield this.fileStorage.store(hash, hashUrls.put, cacheDirectory);
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
catch (ee) {
|
|
94
|
-
const e = (_a = ee.axiosException) !== null && _a !== void 0 ? _a : ee;
|
|
95
|
-
this.messages.cacheError = this.messages.extractErrorMessage(e, 'storage');
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
}));
|
|
99
|
-
this.storeRequests.push(res);
|
|
100
|
-
return res;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
hashUrls(hash) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
if (hash in this.runContext.requests) {
|
|
106
|
-
return (yield this.runContext.requests[hash])[hash];
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
const scheduledTaskHashesWithoutRequests = this.runContext.scheduledTasks
|
|
110
|
-
.filter((t) => !this.runContext.requests[t.hash])
|
|
111
|
-
.map((t) => t.hash);
|
|
112
|
-
if (scheduledTaskHashesWithoutRequests.indexOf(hash) === -1) {
|
|
113
|
-
scheduledTaskHashesWithoutRequests.push(hash);
|
|
114
|
-
}
|
|
115
|
-
const request = this.api.startRun(this.distributedExecutionId, scheduledTaskHashesWithoutRequests);
|
|
116
|
-
scheduledTaskHashesWithoutRequests.forEach((taskHash) => {
|
|
117
|
-
this.runContext.requests[taskHash] = request;
|
|
118
|
-
});
|
|
119
|
-
return (yield request)[hash];
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
waitForStoreRequestsToComplete() {
|
|
124
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const res = yield Promise.all(this.storeRequests).then((r) => r.reduce((a, b) => a && b, true));
|
|
126
|
-
if (!res) {
|
|
127
|
-
throw new Error(`Error when storing artifacts`);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
exports.CloudRemoteCache = CloudRemoteCache;
|
|
133
|
-
//# sourceMappingURL=cloud-remote-cache.js.map
|
|
1
|
+
const a2_0x1601=['store','../../../utilities/environment','messages','next','Error\x20when\x20storing\x20artifacts','hash','.\x20Status\x20404.','CloudRemoteCache','fileStorage','runContext','all','put','then','status','Nx\x20Cloud:\x20Skipping\x20storing\x20','distributedExecutionId','map','response','storeRequests','__esModule','get','storage','throw','requests','note','defineProperty','apply','done','extractErrorMessage','value','statuses','axiosException','__awaiter','There\x20are\x20several\x20reasons\x20why\x20this\x20can\x20happen.','Nx\x20Cloud:\x20Cache\x20miss\x20','reduce','delayedStoreRequests','retrieve','../../../utilities/nx-imports','hashUrls','VERBOSE_LOGGING','startRun','filter','api','push','cacheError','cache-miss'];(function(_0x50ff0f,_0x16012f){const _0x3d3c92=function(_0x3f2ab2){while(--_0x3f2ab2){_0x50ff0f['push'](_0x50ff0f['shift']());}};_0x3d3c92(++_0x16012f);}(a2_0x1601,0x1b8));const a2_0x3d3c=function(_0x50ff0f,_0x16012f){_0x50ff0f=_0x50ff0f-0x0;let _0x3d3c92=a2_0x1601[_0x50ff0f];return _0x3d3c92;};'use strict';var __awaiter=this&&this[a2_0x3d3c('0xf')]||function(_0x2de63f,_0x4bc9ed,_0x418275,_0x38ced1){function _0x137def(_0x51172e){return _0x51172e instanceof _0x418275?_0x51172e:new _0x418275(function(_0x3d8737){_0x3d8737(_0x51172e);});}return new(_0x418275||(_0x418275=Promise))(function(_0x6bffbf,_0x3d7f22){function _0x41b853(_0x3756c1){try{_0x2dce5c(_0x38ced1[a2_0x3d3c('0x21')](_0x3756c1));}catch(_0x4d60e8){_0x3d7f22(_0x4d60e8);}}function _0xdae361(_0x2d543){try{_0x2dce5c(_0x38ced1[a2_0x3d3c('0x5')](_0x2d543));}catch(_0x4e73e6){_0x3d7f22(_0x4e73e6);}}function _0x2dce5c(_0xc95a11){_0xc95a11[a2_0x3d3c('0xa')]?_0x6bffbf(_0xc95a11[a2_0x3d3c('0xc')]):_0x137def(_0xc95a11[a2_0x3d3c('0xc')])['then'](_0x41b853,_0xdae361);}_0x2dce5c((_0x38ced1=_0x38ced1[a2_0x3d3c('0x9')](_0x2de63f,_0x4bc9ed||[]))[a2_0x3d3c('0x21')]());});};Object[a2_0x3d3c('0x8')](exports,a2_0x3d3c('0x2'),{'value':!![]});exports[a2_0x3d3c('0x25')]=void 0x0;const environment_1=require(a2_0x3d3c('0x1f'));const {output}=require(a2_0x3d3c('0x15'));class CloudRemoteCache{constructor(_0x3d29e2,_0x307e8b,_0x1e7c32,_0x35c360,_0x10e091,_0x5c2604){this[a2_0x3d3c('0x20')]=_0x3d29e2;this[a2_0x3d3c('0x1a')]=_0x307e8b;this[a2_0x3d3c('0x27')]=_0x1e7c32;this[a2_0x3d3c('0x26')]=_0x35c360;this[a2_0x3d3c('0x2d')]=_0x10e091;this['storeInCurrentProcess']=_0x5c2604;this[a2_0x3d3c('0x1')]=[];this[a2_0x3d3c('0x13')]=[];}[a2_0x3d3c('0x14')](_0x2f9b1a,_0x47da42){var _0x537cb4;return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages'][a2_0x3d3c('0x1c')])return![];const _0x1860e8=yield this[a2_0x3d3c('0x16')](_0x2f9b1a);if(!_0x1860e8||!_0x1860e8[a2_0x3d3c('0x3')]){if(environment_1[a2_0x3d3c('0x17')]){output['note']({'title':a2_0x3d3c('0x11')+_0x2f9b1a+'.'});}this[a2_0x3d3c('0x27')][a2_0x3d3c('0xd')][_0x2f9b1a]='cache-miss';return![];}try{yield this[a2_0x3d3c('0x26')][a2_0x3d3c('0x14')](_0x2f9b1a,_0x1860e8[a2_0x3d3c('0x3')],_0x47da42);this[a2_0x3d3c('0x27')][a2_0x3d3c('0xd')][_0x2f9b1a]='remote-cache-hit';return!![];}catch(_0x2e0896){const _0x413c09=(_0x537cb4=_0x2e0896['axiosException'])!==null&&_0x537cb4!==void 0x0?_0x537cb4:_0x2e0896;if(_0x413c09[a2_0x3d3c('0x0')]&&_0x413c09[a2_0x3d3c('0x0')][a2_0x3d3c('0x2b')]===0x194){if(environment_1[a2_0x3d3c('0x17')]){output[a2_0x3d3c('0x7')]({'title':a2_0x3d3c('0x11')+_0x2f9b1a+a2_0x3d3c('0x24')});}}else{this[a2_0x3d3c('0x20')][a2_0x3d3c('0x1c')]=this[a2_0x3d3c('0x20')][a2_0x3d3c('0xb')](_0x413c09,a2_0x3d3c('0x4'));}this[a2_0x3d3c('0x27')][a2_0x3d3c('0xd')][_0x2f9b1a]=a2_0x3d3c('0x1d');return![];}});}[a2_0x3d3c('0x1e')](_0x2f85d6,_0x1b9dc6){return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages'][a2_0x3d3c('0x1c')])return![];const _0x510167=Promise['resolve']()[a2_0x3d3c('0x2a')](()=>__awaiter(this,void 0x0,void 0x0,function*(){var _0x467e42;const _0x250998=yield this[a2_0x3d3c('0x16')](_0x2f85d6);if(!_0x250998)return![];if(!_0x250998[a2_0x3d3c('0x29')]){if(environment_1[a2_0x3d3c('0x17')]){output[a2_0x3d3c('0x7')]({'title':a2_0x3d3c('0x2c')+_0x2f85d6+'.','bodyLines':[a2_0x3d3c('0x10'),'Maybe\x20you\x20are\x20using\x20a\x20read-only\x20token\x20or\x20the\x20artifact\x20has\x20already\x20being\x20uploaded.']});}return!![];}if(!this['storeInCurrentProcess']){this[a2_0x3d3c('0x13')][a2_0x3d3c('0x1b')]({'hash':_0x2f85d6,'url':_0x250998[a2_0x3d3c('0x29')]});return!![];}try{yield this[a2_0x3d3c('0x26')][a2_0x3d3c('0x1e')](_0x2f85d6,_0x250998[a2_0x3d3c('0x29')],_0x1b9dc6);return!![];}catch(_0x430ff6){const _0x440106=(_0x467e42=_0x430ff6[a2_0x3d3c('0xe')])!==null&&_0x467e42!==void 0x0?_0x467e42:_0x430ff6;this[a2_0x3d3c('0x20')][a2_0x3d3c('0x1c')]=this[a2_0x3d3c('0x20')][a2_0x3d3c('0xb')](_0x440106,a2_0x3d3c('0x4'));return![];}}));this['storeRequests'][a2_0x3d3c('0x1b')](_0x510167);return _0x510167;});}['hashUrls'](_0x14ab7b){return __awaiter(this,void 0x0,void 0x0,function*(){if(_0x14ab7b in this[a2_0x3d3c('0x27')][a2_0x3d3c('0x6')]){return(yield this['runContext'][a2_0x3d3c('0x6')][_0x14ab7b])[_0x14ab7b];}else{const _0x4b1e46=this[a2_0x3d3c('0x27')]['scheduledTasks'][a2_0x3d3c('0x19')](_0x19606d=>!this[a2_0x3d3c('0x27')][a2_0x3d3c('0x6')][_0x19606d[a2_0x3d3c('0x23')]])[a2_0x3d3c('0x2e')](_0x59402c=>_0x59402c['hash']);if(_0x4b1e46['indexOf'](_0x14ab7b)===-0x1){_0x4b1e46[a2_0x3d3c('0x1b')](_0x14ab7b);}const _0x45ca0c=this[a2_0x3d3c('0x1a')][a2_0x3d3c('0x18')](this[a2_0x3d3c('0x2d')],_0x4b1e46);_0x4b1e46['forEach'](_0x2a160f=>{this[a2_0x3d3c('0x27')][a2_0x3d3c('0x6')][_0x2a160f]=_0x45ca0c;});return(yield _0x45ca0c)[_0x14ab7b];}});}['waitForStoreRequestsToComplete'](){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x3a7abc=yield Promise[a2_0x3d3c('0x28')](this['storeRequests'])[a2_0x3d3c('0x2a')](_0x48b45c=>_0x48b45c[a2_0x3d3c('0x12')]((_0x12e5dc,_0x16c32b)=>_0x12e5dc&&_0x16c32b,!![]));if(!_0x3a7abc){throw new Error(a2_0x3d3c('0x22'));}});}}exports[a2_0x3d3c('0x25')]=CloudRemoteCache;
|
|
@@ -1,168 +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.CloudRunApi = void 0;
|
|
13
|
-
const axios_1 = require("../../../utilities/axios");
|
|
14
|
-
const environment_1 = require("../../../utilities/environment");
|
|
15
|
-
const fs_1 = require("fs");
|
|
16
|
-
const zlib_1 = require("zlib");
|
|
17
|
-
const util_1 = require("util");
|
|
18
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
19
|
-
const { output } = require('../../../utilities/nx-imports');
|
|
20
|
-
class CloudRunApi {
|
|
21
|
-
constructor(messages, runContext, options, machineInfo) {
|
|
22
|
-
this.messages = messages;
|
|
23
|
-
this.runContext = runContext;
|
|
24
|
-
this.machineInfo = machineInfo;
|
|
25
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
26
|
-
}
|
|
27
|
-
startRun(distributedExecutionId, hashes) {
|
|
28
|
-
var _a;
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
// API is not working, don't make the end request
|
|
31
|
-
if (this.messages.apiError)
|
|
32
|
-
return {};
|
|
33
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('startRun');
|
|
34
|
-
try {
|
|
35
|
-
const request = {
|
|
36
|
-
meta: {
|
|
37
|
-
nxCloudVersion: this.nxCloudVersion(),
|
|
38
|
-
},
|
|
39
|
-
branch: (0, environment_1.getBranch)(),
|
|
40
|
-
runGroup: (0, environment_1.getRunGroup)(),
|
|
41
|
-
ciExecutionId: (0, environment_1.getCIExecutionId)(),
|
|
42
|
-
ciExecutionEnv: (0, environment_1.getCIExecutionEnv)(),
|
|
43
|
-
distributedExecutionId,
|
|
44
|
-
hashes,
|
|
45
|
-
};
|
|
46
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
47
|
-
output.note({
|
|
48
|
-
title: 'RunStart',
|
|
49
|
-
bodyLines: ['\n' + JSON.stringify(request, null, 2)],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const resp = yield (0, axios_1.printDuration)('RunStart duration', () => (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/runs/start', request)));
|
|
53
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
54
|
-
if (resp.data && resp.data.message) {
|
|
55
|
-
this.messages.message = resp.data.message;
|
|
56
|
-
}
|
|
57
|
-
if (!resp.data || !resp.data.urls) {
|
|
58
|
-
this.messages.apiError = `Invalid Nx Cloud response: ${JSON.stringify(resp.data)}`;
|
|
59
|
-
return {};
|
|
60
|
-
}
|
|
61
|
-
return resp.data.urls;
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
65
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
66
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
67
|
-
this.messages.apiError = this.messages.extractErrorMessage(e, 'api');
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
createReqBody(run, tasks, ciExecutionContext, linkId) {
|
|
73
|
-
const uncompressedReqBody = Object.assign(Object.assign({ meta: {
|
|
74
|
-
nxCloudVersion: this.nxCloudVersion(),
|
|
75
|
-
}, tasks,
|
|
76
|
-
run,
|
|
77
|
-
linkId }, ciExecutionContext), { machineInfo: this.machineInfo });
|
|
78
|
-
return JSON.stringify(uncompressedReqBody);
|
|
79
|
-
}
|
|
80
|
-
endRun(run, tasks, ciExecutionContext, linkId) {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
// API is not working, don't make the end request
|
|
84
|
-
if (this.messages.apiError)
|
|
85
|
-
return false;
|
|
86
|
-
let uncompressedBodyString = this.createReqBody(run, tasks, ciExecutionContext, linkId);
|
|
87
|
-
// if the req body is > 20mb, remove hashDetails
|
|
88
|
-
if (uncompressedBodyString.length > 20 * 1000 * 1000) {
|
|
89
|
-
uncompressedBodyString = this.createReqBody(run, tasks.map((t) => (Object.assign(Object.assign({}, t), { hashDetails: undefined }))), ciExecutionContext, linkId);
|
|
90
|
-
}
|
|
91
|
-
const uncompressedBuffer = Buffer.from(uncompressedBodyString);
|
|
92
|
-
const compressedBuffer = yield (0, util_1.promisify)(zlib_1.gzip)(uncompressedBuffer);
|
|
93
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('endRun');
|
|
94
|
-
try {
|
|
95
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
96
|
-
const t = tasks.map((tt) => {
|
|
97
|
-
return Object.assign(Object.assign({}, tt), { terminalOutput: tt.terminalOutput
|
|
98
|
-
? `${tt.terminalOutput.slice(0, 20)}...`
|
|
99
|
-
: undefined });
|
|
100
|
-
});
|
|
101
|
-
output.note({
|
|
102
|
-
title: 'RunEnd. Completed tasks',
|
|
103
|
-
bodyLines: ['\n' + JSON.stringify(t, null, 2)],
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
const resp = yield (0, axios_1.printDuration)('RunEnd duration', () => (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/runs/end', compressedBuffer, {
|
|
107
|
-
headers: Object.assign(Object.assign({}, this.apiAxiosInstance.defaults.headers), { 'Content-Encoding': 'gzip', 'Content-Type': 'application/octet-stream' }),
|
|
108
|
-
})));
|
|
109
|
-
if (resp) {
|
|
110
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
111
|
-
if (resp.data && resp.data.runUrl && resp.data.status === 'success') {
|
|
112
|
-
this.runContext.runUrl = resp.data.runUrl;
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
if (resp.data && resp.data.status) {
|
|
116
|
-
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data.message)}`;
|
|
117
|
-
}
|
|
118
|
-
else if (resp.data && typeof resp.data === 'string') {
|
|
119
|
-
if (resp.data !== 'success') {
|
|
120
|
-
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data)}`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
this.messages.apiError = `Invalid end run response: ${JSON.stringify(resp.data)}`;
|
|
125
|
-
}
|
|
126
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
127
|
-
output.note({
|
|
128
|
-
title: 'Invalid end run response',
|
|
129
|
-
bodyLines: [JSON.stringify(resp.data, null, 2)],
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
output.error({
|
|
135
|
-
title: 'Nx Cloud: Unknown Error Occurred',
|
|
136
|
-
bodyLines: [
|
|
137
|
-
'Run completion responded with `undefined`.',
|
|
138
|
-
'Run Details:',
|
|
139
|
-
JSON.stringify(run, null, 2),
|
|
140
|
-
'Stack Trace:',
|
|
141
|
-
JSON.stringify(new Error().stack, null, 2),
|
|
142
|
-
],
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
catch (ee) {
|
|
148
|
-
recorder.recordMetric(((_a = ee === null || ee === void 0 ? void 0 : ee.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
149
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(ee.axiosException.response)
|
|
150
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
151
|
-
const e = (_b = ee.axiosException) !== null && _b !== void 0 ? _b : ee;
|
|
152
|
-
this.messages.apiError = this.messages.extractErrorMessage(e, 'api');
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
nxCloudVersion() {
|
|
158
|
-
try {
|
|
159
|
-
const v = JSON.parse((0, fs_1.readFileSync)(`package.json`).toString());
|
|
160
|
-
return v.devDependencies['@nrwl/nx-cloud'];
|
|
161
|
-
}
|
|
162
|
-
catch (e) {
|
|
163
|
-
return 'unknown';
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
exports.CloudRunApi = CloudRunApi;
|
|
168
|
-
//# sourceMappingURL=cloud-run.api.js.map
|
|
1
|
+
const a3_0x2e55=['status','__esModule','RunStart\x20duration','machineInfo','createMetricRecorder','stringify','api','../../../utilities/environment','endRun','assign','post','zlib','Invalid\x20Nx\x20Cloud\x20response:\x20','/nx-cloud/runs/start','throw','terminalOutput','../../../utilities/nx-imports','runUrl','devDependencies','__awaiter','Stack\x20Trace:','util','getRunGroup','RunStart','RunEnd.\x20Completed\x20tasks','apiAxiosInstance','RUNNER_FAILURE_PERF_ENTRY','printDuration','message','messages','toString','value','response','recordMetric','getCIExecutionId','VERBOSE_LOGGING','gzip','Invalid\x20end\x20run\x20response:\x20','slice','defineProperty','createReqBody','runContext','promisify','success','defaults','/nx-cloud/runs/end','axiosException','headers','Run\x20completion\x20responded\x20with\x20`undefined`.','getCIExecutionEnv','mapRespToPerfEntry','application/octet-stream','from','Nx\x20Cloud:\x20Unknown\x20Error\x20Occurred','package.json','...','axiosMultipleTries','done','note','../../../utilities/axios','apply','then','extractErrorMessage','data','@nrwl/nx-cloud','urls','RunEnd\x20duration','Run\x20Details:','nxCloudVersion','parse','apiError','readFileSync','next','Invalid\x20end\x20run\x20response','startRun','../../../utilities/metric-logger'];(function(_0xcda7,_0x2e5508){const _0x110f4c=function(_0x2e0b47){while(--_0x2e0b47){_0xcda7['push'](_0xcda7['shift']());}};_0x110f4c(++_0x2e5508);}(a3_0x2e55,0x64));const a3_0x110f=function(_0xcda7,_0x2e5508){_0xcda7=_0xcda7-0x0;let _0x110f4c=a3_0x2e55[_0xcda7];return _0x110f4c;};'use strict';var __awaiter=this&&this[a3_0x110f('0x47')]||function(_0x355a85,_0x8ce1e,_0x3a2b3c,_0x10b0e4){function _0x3e45d8(_0x671022){return _0x671022 instanceof _0x3a2b3c?_0x671022:new _0x3a2b3c(function(_0x2fdbdf){_0x2fdbdf(_0x671022);});}return new(_0x3a2b3c||(_0x3a2b3c=Promise))(function(_0x598c18,_0x145567){function _0x5961d2(_0x2f4f62){try{_0x193a93(_0x10b0e4['next'](_0x2f4f62));}catch(_0x4a9a90){_0x145567(_0x4a9a90);}}function _0xfaf1df(_0x23ef73){try{_0x193a93(_0x10b0e4[a3_0x110f('0x42')](_0x23ef73));}catch(_0x3fd822){_0x145567(_0x3fd822);}}function _0x193a93(_0x10af96){_0x10af96[a3_0x110f('0x21')]?_0x598c18(_0x10af96[a3_0x110f('0x7')]):_0x3e45d8(_0x10af96['value'])[a3_0x110f('0x25')](_0x5961d2,_0xfaf1df);}_0x193a93((_0x10b0e4=_0x10b0e4[a3_0x110f('0x24')](_0x355a85,_0x8ce1e||[]))[a3_0x110f('0x30')]());});};Object[a3_0x110f('0xf')](exports,a3_0x110f('0x35'),{'value':!![]});exports['CloudRunApi']=void 0x0;const axios_1=require(a3_0x110f('0x23'));const environment_1=require(a3_0x110f('0x3b'));const fs_1=require('fs');const zlib_1=require(a3_0x110f('0x3f'));const util_1=require(a3_0x110f('0x49'));const metric_logger_1=require(a3_0x110f('0x33'));const {output}=require(a3_0x110f('0x44'));class CloudRunApi{constructor(_0x1a0b5a,_0x22b79e,_0x441cea,_0x46ce3c){this[a3_0x110f('0x5')]=_0x1a0b5a;this[a3_0x110f('0x11')]=_0x22b79e;this['machineInfo']=_0x46ce3c;this[a3_0x110f('0x1')]=(0x0,axios_1['createApiAxiosInstance'])(_0x441cea);}['startRun'](_0x258387,_0x51049b){var _0x361855;return __awaiter(this,void 0x0,void 0x0,function*(){if(this['messages'][a3_0x110f('0x2e')])return{};const _0x3fd037=(0x0,metric_logger_1[a3_0x110f('0x38')])(a3_0x110f('0x32'));try{const _0x4f97ac={'meta':{'nxCloudVersion':this[a3_0x110f('0x2c')]()},'branch':(0x0,environment_1['getBranch'])(),'runGroup':(0x0,environment_1[a3_0x110f('0x4a')])(),'ciExecutionId':(0x0,environment_1[a3_0x110f('0xa')])(),'ciExecutionEnv':(0x0,environment_1[a3_0x110f('0x19')])(),'distributedExecutionId':_0x258387,'hashes':_0x51049b};if(environment_1[a3_0x110f('0xb')]){output[a3_0x110f('0x22')]({'title':a3_0x110f('0x4b'),'bodyLines':['\x0a'+JSON[a3_0x110f('0x39')](_0x4f97ac,null,0x2)]});}const _0x33c1de=yield(0x0,axios_1[a3_0x110f('0x3')])(a3_0x110f('0x36'),()=>(0x0,axios_1[a3_0x110f('0x20')])(()=>this['apiAxiosInstance']['post'](a3_0x110f('0x41'),_0x4f97ac)));_0x3fd037[a3_0x110f('0x9')]((0x0,metric_logger_1[a3_0x110f('0x1a')])(_0x33c1de));if(_0x33c1de[a3_0x110f('0x27')]&&_0x33c1de['data'][a3_0x110f('0x4')]){this[a3_0x110f('0x5')]['message']=_0x33c1de[a3_0x110f('0x27')]['message'];}if(!_0x33c1de[a3_0x110f('0x27')]||!_0x33c1de['data'][a3_0x110f('0x29')]){this[a3_0x110f('0x5')][a3_0x110f('0x2e')]=a3_0x110f('0x40')+JSON[a3_0x110f('0x39')](_0x33c1de[a3_0x110f('0x27')]);return{};}return _0x33c1de[a3_0x110f('0x27')][a3_0x110f('0x29')];}catch(_0x446265){_0x3fd037['recordMetric'](((_0x361855=_0x446265===null||_0x446265===void 0x0?void 0x0:_0x446265['axiosException'])===null||_0x361855===void 0x0?void 0x0:_0x361855[a3_0x110f('0x8')])?(0x0,metric_logger_1[a3_0x110f('0x1a')])(_0x446265[a3_0x110f('0x16')][a3_0x110f('0x8')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);this[a3_0x110f('0x5')][a3_0x110f('0x2e')]=this[a3_0x110f('0x5')][a3_0x110f('0x26')](_0x446265,'api');return{};}});}['createReqBody'](_0xb11904,_0x4c4d2a,_0x44b1f3,_0x13227b){const _0x2191a0=Object[a3_0x110f('0x3d')](Object[a3_0x110f('0x3d')]({'meta':{'nxCloudVersion':this[a3_0x110f('0x2c')]()},'tasks':_0x4c4d2a,'run':_0xb11904,'linkId':_0x13227b},_0x44b1f3),{'machineInfo':this[a3_0x110f('0x37')]});return JSON[a3_0x110f('0x39')](_0x2191a0);}['endRun'](_0x5c5632,_0x4fb20d,_0xc9e0ca,_0x2718b6){var _0x576ebc,_0x4f3ed0;return __awaiter(this,void 0x0,void 0x0,function*(){if(this[a3_0x110f('0x5')]['apiError'])return![];let _0x51f3c8=this[a3_0x110f('0x10')](_0x5c5632,_0x4fb20d,_0xc9e0ca,_0x2718b6);if(_0x51f3c8['length']>0x14*0x3e8*0x3e8){_0x51f3c8=this[a3_0x110f('0x10')](_0x5c5632,_0x4fb20d['map'](_0x57db96=>Object[a3_0x110f('0x3d')](Object[a3_0x110f('0x3d')]({},_0x57db96),{'hashDetails':undefined})),_0xc9e0ca,_0x2718b6);}const _0x471e44=Buffer[a3_0x110f('0x1c')](_0x51f3c8);const _0x5805f9=yield(0x0,util_1[a3_0x110f('0x12')])(zlib_1['gzip'])(_0x471e44);const _0x1d47fb=(0x0,metric_logger_1[a3_0x110f('0x38')])(a3_0x110f('0x3c'));try{if(environment_1[a3_0x110f('0xb')]){const _0x383b34=_0x4fb20d['map'](_0x497d94=>{return Object[a3_0x110f('0x3d')](Object[a3_0x110f('0x3d')]({},_0x497d94),{'terminalOutput':_0x497d94[a3_0x110f('0x43')]?_0x497d94[a3_0x110f('0x43')][a3_0x110f('0xe')](0x0,0x14)+a3_0x110f('0x1f'):undefined});});output[a3_0x110f('0x22')]({'title':a3_0x110f('0x0'),'bodyLines':['\x0a'+JSON[a3_0x110f('0x39')](_0x383b34,null,0x2)]});}const _0x3b3b9f=yield(0x0,axios_1[a3_0x110f('0x3')])(a3_0x110f('0x2a'),()=>(0x0,axios_1[a3_0x110f('0x20')])(()=>this['apiAxiosInstance'][a3_0x110f('0x3e')](a3_0x110f('0x15'),_0x5805f9,{'headers':Object[a3_0x110f('0x3d')](Object[a3_0x110f('0x3d')]({},this[a3_0x110f('0x1')][a3_0x110f('0x14')][a3_0x110f('0x17')]),{'Content-Encoding':a3_0x110f('0xc'),'Content-Type':a3_0x110f('0x1b')})})));if(_0x3b3b9f){_0x1d47fb[a3_0x110f('0x9')]((0x0,metric_logger_1[a3_0x110f('0x1a')])(_0x3b3b9f));if(_0x3b3b9f[a3_0x110f('0x27')]&&_0x3b3b9f[a3_0x110f('0x27')]['runUrl']&&_0x3b3b9f['data'][a3_0x110f('0x34')]===a3_0x110f('0x13')){this['runContext'][a3_0x110f('0x45')]=_0x3b3b9f[a3_0x110f('0x27')][a3_0x110f('0x45')];return!![];}if(_0x3b3b9f[a3_0x110f('0x27')]&&_0x3b3b9f['data']['status']){this['messages'][a3_0x110f('0x2e')]=a3_0x110f('0xd')+JSON[a3_0x110f('0x39')](_0x3b3b9f['data'][a3_0x110f('0x4')]);}else if(_0x3b3b9f[a3_0x110f('0x27')]&&typeof _0x3b3b9f[a3_0x110f('0x27')]==='string'){if(_0x3b3b9f['data']!==a3_0x110f('0x13')){this[a3_0x110f('0x5')][a3_0x110f('0x2e')]=a3_0x110f('0xd')+JSON[a3_0x110f('0x39')](_0x3b3b9f[a3_0x110f('0x27')]);}}else{this['messages'][a3_0x110f('0x2e')]=a3_0x110f('0xd')+JSON[a3_0x110f('0x39')](_0x3b3b9f[a3_0x110f('0x27')]);}if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a3_0x110f('0x31'),'bodyLines':[JSON[a3_0x110f('0x39')](_0x3b3b9f[a3_0x110f('0x27')],null,0x2)]});}}else{output['error']({'title':a3_0x110f('0x1d'),'bodyLines':[a3_0x110f('0x18'),a3_0x110f('0x2b'),JSON[a3_0x110f('0x39')](_0x5c5632,null,0x2),a3_0x110f('0x48'),JSON['stringify'](new Error()['stack'],null,0x2)]});}return![];}catch(_0x400f67){_0x1d47fb[a3_0x110f('0x9')](((_0x576ebc=_0x400f67===null||_0x400f67===void 0x0?void 0x0:_0x400f67[a3_0x110f('0x16')])===null||_0x576ebc===void 0x0?void 0x0:_0x576ebc[a3_0x110f('0x8')])?(0x0,metric_logger_1[a3_0x110f('0x1a')])(_0x400f67['axiosException'][a3_0x110f('0x8')]):metric_logger_1[a3_0x110f('0x2')]);const _0x1dc839=(_0x4f3ed0=_0x400f67[a3_0x110f('0x16')])!==null&&_0x4f3ed0!==void 0x0?_0x4f3ed0:_0x400f67;this[a3_0x110f('0x5')][a3_0x110f('0x2e')]=this[a3_0x110f('0x5')][a3_0x110f('0x26')](_0x1dc839,a3_0x110f('0x3a'));return![];}});}[a3_0x110f('0x2c')](){try{const _0xbaebbc=JSON[a3_0x110f('0x2d')]((0x0,fs_1[a3_0x110f('0x2f')])(a3_0x110f('0x1e'))[a3_0x110f('0x6')]());return _0xbaebbc[a3_0x110f('0x46')][a3_0x110f('0x28')];}catch(_0x1c3c8e){return'unknown';}}}exports['CloudRunApi']=CloudRunApi;
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateUniqueLinkId = void 0;
|
|
4
|
-
const upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
5
|
-
const digits = '0123456789';
|
|
6
|
-
const lower = upper.toLowerCase();
|
|
7
|
-
const alphanum = upper + lower + digits;
|
|
8
|
-
function generateUniqueLinkId() {
|
|
9
|
-
let res = '';
|
|
10
|
-
for (let i = 0; i < 10; ++i) {
|
|
11
|
-
res += alphanum[Math.floor(Math.random() * alphanum.length)];
|
|
12
|
-
}
|
|
13
|
-
return res;
|
|
14
|
-
}
|
|
15
|
-
exports.generateUniqueLinkId = generateUniqueLinkId;
|
|
16
|
-
//# sourceMappingURL=id-generator.js.map
|
|
1
|
+
const a4_0x144a=['generateUniqueLinkId','0123456789','random','floor','defineProperty','length'];(function(_0x50bfb9,_0x144a03){const _0x4873c5=function(_0xba480a){while(--_0xba480a){_0x50bfb9['push'](_0x50bfb9['shift']());}};_0x4873c5(++_0x144a03);}(a4_0x144a,0x1b7));const a4_0x4873=function(_0x50bfb9,_0x144a03){_0x50bfb9=_0x50bfb9-0x0;let _0x4873c5=a4_0x144a[_0x50bfb9];return _0x4873c5;};'use strict';Object[a4_0x4873('0x3')](exports,'__esModule',{'value':!![]});exports[a4_0x4873('0x5')]=void 0x0;const upper='ABCDEFGHIJKLMNOPQRSTUVWXYZ';const digits=a4_0x4873('0x0');const lower=upper['toLowerCase']();const alphanum=upper+lower+digits;function generateUniqueLinkId(){let _0x1cbe33='';for(let _0x494c0b=0x0;_0x494c0b<0xa;++_0x494c0b){_0x1cbe33+=alphanum[Math[a4_0x4873('0x2')](Math[a4_0x4873('0x1')]()*alphanum[a4_0x4873('0x4')])];}return _0x1cbe33;}exports[a4_0x4873('0x5')]=generateUniqueLinkId;
|
|
@@ -1,93 +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.DistributedAgentApi = void 0;
|
|
13
|
-
const axios_1 = require("../../../utilities/axios");
|
|
14
|
-
const environment_1 = require("../../../utilities/environment");
|
|
15
|
-
const metric_logger_1 = require("../../../utilities/metric-logger");
|
|
16
|
-
const { output } = require('../../../utilities/nx-imports');
|
|
17
|
-
class DistributedAgentApi {
|
|
18
|
-
constructor(options, branch, runGroup, ciExecutionId, ciExecutionEnv, agentName) {
|
|
19
|
-
this.branch = branch;
|
|
20
|
-
this.runGroup = runGroup;
|
|
21
|
-
this.ciExecutionId = ciExecutionId;
|
|
22
|
-
this.ciExecutionEnv = ciExecutionEnv;
|
|
23
|
-
this.agentName = agentName;
|
|
24
|
-
this.apiAxiosInstance = (0, axios_1.createApiAxiosInstance)(options);
|
|
25
|
-
}
|
|
26
|
-
tasks(executionId, statusCode, completedTasks, targets) {
|
|
27
|
-
var _a;
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('dtePollTasks');
|
|
30
|
-
try {
|
|
31
|
-
const res = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/tasks', {
|
|
32
|
-
runGroup: this.runGroup,
|
|
33
|
-
ciExecutionId: this.ciExecutionId,
|
|
34
|
-
ciExecutionEnv: this.ciExecutionEnv,
|
|
35
|
-
agentName: this.agentName,
|
|
36
|
-
executionId,
|
|
37
|
-
statusCode,
|
|
38
|
-
completedTasks,
|
|
39
|
-
targets,
|
|
40
|
-
}));
|
|
41
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(res));
|
|
42
|
-
return res.data;
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
46
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
47
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
48
|
-
throw e;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
completeRunGroupWithError(error) {
|
|
53
|
-
var _a;
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
56
|
-
output.note({
|
|
57
|
-
title: 'Completing with an error',
|
|
58
|
-
bodyLines: [
|
|
59
|
-
`ciExecutionId: ${this.ciExecutionId}`,
|
|
60
|
-
`ciExecutionEnv: ${this.ciExecutionEnv}`,
|
|
61
|
-
`runGroup: ${this.runGroup}`,
|
|
62
|
-
`error: ${error}`,
|
|
63
|
-
],
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
const recorder = (0, metric_logger_1.createMetricRecorder)('completeRunGroup');
|
|
67
|
-
try {
|
|
68
|
-
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
69
|
-
branch: this.branch,
|
|
70
|
-
runGroup: this.runGroup,
|
|
71
|
-
ciExecutionId: this.ciExecutionId,
|
|
72
|
-
ciExecutionEnv: this.ciExecutionEnv,
|
|
73
|
-
agentName: this.agentName,
|
|
74
|
-
criticalErrorMessage: error,
|
|
75
|
-
}));
|
|
76
|
-
if (environment_1.VERBOSE_LOGGING) {
|
|
77
|
-
output.note({
|
|
78
|
-
title: 'Completed run group with an error',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
82
|
-
}
|
|
83
|
-
catch (e) {
|
|
84
|
-
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
85
|
-
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
86
|
-
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
87
|
-
console.error(e);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.DistributedAgentApi = DistributedAgentApi;
|
|
93
|
-
//# sourceMappingURL=distributed-agent.api.js.map
|
|
1
|
+
const a5_0x4d29=['RUNNER_FAILURE_PERF_ENTRY','then','data','tasks','ciExecutionId','post','ciExecutionEnv','ciExecutionId:\x20','completeRunGroupWithError','../../../utilities/environment','createApiAxiosInstance','branch','/nx-cloud/executions/tasks','Completing\x20with\x20an\x20error','__esModule','error:\x20','next','note','mapRespToPerfEntry','runGroup','recordMetric','axiosException','/nx-cloud/executions/complete-run-group','VERBOSE_LOGGING','__awaiter','../../../utilities/axios','response','createMetricRecorder','value','agentName','axiosMultipleTries','runGroup:\x20','completeRunGroup','apiAxiosInstance','DistributedAgentApi'];(function(_0x51b01d,_0x4d295d){const _0x5b5845=function(_0x316d98){while(--_0x316d98){_0x51b01d['push'](_0x51b01d['shift']());}};_0x5b5845(++_0x4d295d);}(a5_0x4d29,0x1bb));const a5_0x5b58=function(_0x51b01d,_0x4d295d){_0x51b01d=_0x51b01d-0x0;let _0x5b5845=a5_0x4d29[_0x51b01d];return _0x5b5845;};'use strict';var __awaiter=this&&this[a5_0x5b58('0x1')]||function(_0xcf0e62,_0x441793,_0x27a7f0,_0x346942){function _0x5889e1(_0x2212d0){return _0x2212d0 instanceof _0x27a7f0?_0x2212d0:new _0x27a7f0(function(_0x422a39){_0x422a39(_0x2212d0);});}return new(_0x27a7f0||(_0x27a7f0=Promise))(function(_0x35816e,_0xf41dac){function _0x281daa(_0x3c8d4b){try{_0x4952fd(_0x346942[a5_0x5b58('0x1c')](_0x3c8d4b));}catch(_0x49a03f){_0xf41dac(_0x49a03f);}}function _0x5ae042(_0x14b3b2){try{_0x4952fd(_0x346942['throw'](_0x14b3b2));}catch(_0x152958){_0xf41dac(_0x152958);}}function _0x4952fd(_0x491287){_0x491287['done']?_0x35816e(_0x491287[a5_0x5b58('0x5')]):_0x5889e1(_0x491287[a5_0x5b58('0x5')])[a5_0x5b58('0xd')](_0x281daa,_0x5ae042);}_0x4952fd((_0x346942=_0x346942['apply'](_0xcf0e62,_0x441793||[]))[a5_0x5b58('0x1c')]());});};Object['defineProperty'](exports,a5_0x5b58('0x1a'),{'value':!![]});exports[a5_0x5b58('0xb')]=void 0x0;const axios_1=require(a5_0x5b58('0x2'));const environment_1=require(a5_0x5b58('0x15'));const metric_logger_1=require('../../../utilities/metric-logger');const {output}=require('../../../utilities/nx-imports');class DistributedAgentApi{constructor(_0x1d33cd,_0x3525a7,_0x3c93fc,_0x1eb50c,_0x51ee9e,_0x222c86){this[a5_0x5b58('0x17')]=_0x3525a7;this['runGroup']=_0x3c93fc;this['ciExecutionId']=_0x1eb50c;this[a5_0x5b58('0x12')]=_0x51ee9e;this['agentName']=_0x222c86;this[a5_0x5b58('0xa')]=(0x0,axios_1[a5_0x5b58('0x16')])(_0x1d33cd);}[a5_0x5b58('0xf')](_0x485b88,_0x13e50a,_0x138904,_0x315e03){var _0x51e21e;return __awaiter(this,void 0x0,void 0x0,function*(){const _0x22bfbe=(0x0,metric_logger_1[a5_0x5b58('0x4')])('dtePollTasks');try{const _0x448fe1=yield(0x0,axios_1[a5_0x5b58('0x7')])(()=>this[a5_0x5b58('0xa')][a5_0x5b58('0x11')](a5_0x5b58('0x18'),{'runGroup':this[a5_0x5b58('0x1f')],'ciExecutionId':this[a5_0x5b58('0x10')],'ciExecutionEnv':this[a5_0x5b58('0x12')],'agentName':this[a5_0x5b58('0x6')],'executionId':_0x485b88,'statusCode':_0x13e50a,'completedTasks':_0x138904,'targets':_0x315e03}));_0x22bfbe[a5_0x5b58('0x20')]((0x0,metric_logger_1[a5_0x5b58('0x1e')])(_0x448fe1));return _0x448fe1[a5_0x5b58('0xe')];}catch(_0x356725){_0x22bfbe[a5_0x5b58('0x20')](((_0x51e21e=_0x356725===null||_0x356725===void 0x0?void 0x0:_0x356725[a5_0x5b58('0x21')])===null||_0x51e21e===void 0x0?void 0x0:_0x51e21e[a5_0x5b58('0x3')])?(0x0,metric_logger_1[a5_0x5b58('0x1e')])(_0x356725[a5_0x5b58('0x21')][a5_0x5b58('0x3')]):metric_logger_1['RUNNER_FAILURE_PERF_ENTRY']);throw _0x356725;}});}[a5_0x5b58('0x14')](_0x461145){var _0x34b519;return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a5_0x5b58('0x0')]){output['note']({'title':a5_0x5b58('0x19'),'bodyLines':[a5_0x5b58('0x13')+this[a5_0x5b58('0x10')],'ciExecutionEnv:\x20'+this[a5_0x5b58('0x12')],a5_0x5b58('0x8')+this[a5_0x5b58('0x1f')],a5_0x5b58('0x1b')+_0x461145]});}const _0x488d8e=(0x0,metric_logger_1[a5_0x5b58('0x4')])(a5_0x5b58('0x9'));try{const _0x14d2a8=yield(0x0,axios_1[a5_0x5b58('0x7')])(()=>this[a5_0x5b58('0xa')][a5_0x5b58('0x11')](a5_0x5b58('0x22'),{'branch':this[a5_0x5b58('0x17')],'runGroup':this[a5_0x5b58('0x1f')],'ciExecutionId':this[a5_0x5b58('0x10')],'ciExecutionEnv':this[a5_0x5b58('0x12')],'agentName':this[a5_0x5b58('0x6')],'criticalErrorMessage':_0x461145}));if(environment_1[a5_0x5b58('0x0')]){output[a5_0x5b58('0x1d')]({'title':'Completed\x20run\x20group\x20with\x20an\x20error'});}_0x488d8e[a5_0x5b58('0x20')]((0x0,metric_logger_1[a5_0x5b58('0x1e')])(_0x14d2a8));}catch(_0x2689c3){_0x488d8e['recordMetric'](((_0x34b519=_0x2689c3===null||_0x2689c3===void 0x0?void 0x0:_0x2689c3[a5_0x5b58('0x21')])===null||_0x34b519===void 0x0?void 0x0:_0x34b519[a5_0x5b58('0x3')])?(0x0,metric_logger_1[a5_0x5b58('0x1e')])(_0x2689c3[a5_0x5b58('0x21')][a5_0x5b58('0x3')]):metric_logger_1[a5_0x5b58('0xc')]);console['error'](_0x2689c3);}});}}exports[a5_0x5b58('0xb')]=DistributedAgentApi;
|