@nrwl/nx-cloud 13.3.1 → 13.5.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nx-cloud.js +10 -3
- package/bin/nx-cloud.js.map +1 -1
- package/generators.json +12 -0
- package/lib/core/api/error-reporter.api.d.ts +6 -0
- package/lib/core/api/error-reporter.api.js +36 -0
- package/lib/core/api/error-reporter.api.js.map +1 -0
- package/lib/core/api/run-group.api.d.ts +2 -2
- package/lib/core/api/run-group.api.js +73 -1
- package/lib/core/api/run-group.api.js.map +1 -1
- package/lib/core/commands/clean-up-agents.js +3 -3
- package/lib/core/commands/clean-up-agents.js.map +1 -1
- package/lib/core/commands/record-output.d.ts +0 -15
- package/lib/core/commands/record-output.js +36 -57
- package/lib/core/commands/record-output.js.map +1 -1
- package/lib/core/commands/start-ci-run.js +27 -5
- package/lib/core/commands/start-ci-run.js.map +1 -1
- package/lib/core/commands/stop-all-agents.js +6 -3
- package/lib/core/commands/stop-all-agents.js.map +1 -1
- package/lib/core/commands/upload-and-show-run-details.d.ts +1 -0
- package/lib/core/commands/upload-and-show-run-details.js +65 -0
- package/lib/core/commands/upload-and-show-run-details.js.map +1 -0
- package/lib/core/error/print-cacheable-targets-error.d.ts +1 -0
- package/lib/core/error/print-cacheable-targets-error.js +15 -0
- package/lib/core/error/print-cacheable-targets-error.js.map +1 -0
- package/lib/core/error/print-invalid-runner-error.d.ts +1 -0
- package/lib/core/error/print-invalid-runner-error.js +17 -0
- package/lib/core/error/print-invalid-runner-error.js.map +1 -0
- package/lib/core/error/print-run-group-error.d.ts +1 -0
- package/lib/core/error/print-run-group-error.js +9 -5
- package/lib/core/error/print-run-group-error.js.map +1 -1
- package/lib/core/file-storage/file-storage.d.ts +11 -1
- package/lib/core/file-storage/file-storage.js +103 -21
- package/lib/core/file-storage/file-storage.js.map +1 -1
- package/lib/core/models/cloud-task-runner-options.d.ts +1 -1
- package/lib/core/models/distributed-agent/tasks-api-response.model.d.ts +6 -0
- package/lib/core/models/run-context.model.d.ts +89 -1
- package/lib/core/models/run-context.model.js +19 -0
- package/lib/core/models/run-context.model.js.map +1 -1
- package/lib/core/models/run-data.model.d.ts +1 -1
- package/lib/core/models/task-execution.model.d.ts +1 -0
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.d.ts +1 -7
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js +93 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled-life-cycle.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.d.ts +1 -2
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js +320 -1
- package/lib/core/runners/cloud-enabled/cloud-enabled.runner.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.d.ts +8 -2
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js +133 -1
- package/lib/core/runners/cloud-enabled/cloud-remote-cache.js.map +1 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.d.ts +7 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.js +168 -1
- package/lib/core/runners/cloud-enabled/cloud-run.api.js.map +1 -1
- package/lib/core/runners/cloud-enabled/id-generator.d.ts +1 -0
- package/lib/core/runners/cloud-enabled/id-generator.js +16 -0
- package/lib/core/runners/cloud-enabled/id-generator.js.map +1 -0
- package/lib/core/runners/distributed-agent/distributed-agent.api.d.ts +6 -3
- package/lib/core/runners/distributed-agent/distributed-agent.api.js +93 -1
- package/lib/core/runners/distributed-agent/distributed-agent.api.js.map +1 -1
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js +157 -1
- package/lib/core/runners/distributed-agent/distributed-agent.impl.js.map +1 -1
- package/lib/core/runners/distributed-agent/execute-tasks.d.ts +10 -0
- package/lib/core/runners/distributed-agent/execute-tasks.js +114 -0
- package/lib/core/runners/distributed-agent/execute-tasks.js.map +1 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-nx-imperative-api.d.ts +9 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-nx-imperative-api.js +58 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-nx-imperative-api.js.map +1 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-run-many.d.ts +9 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-run-many.js +97 -0
- package/lib/core/runners/distributed-agent/invoke-tasks-using-run-many.js.map +1 -0
- package/lib/core/runners/distributed-execution/distributed-execution.api.d.ts +2 -2
- package/lib/core/runners/distributed-execution/distributed-execution.api.js +152 -1
- package/lib/core/runners/distributed-execution/distributed-execution.api.js.map +1 -1
- package/lib/core/runners/distributed-execution/distributed-execution.runner.d.ts +0 -11
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js +118 -1
- package/lib/core/runners/distributed-execution/distributed-execution.runner.js.map +1 -1
- package/lib/core/runners/distributed-execution/process-task.d.ts +7 -0
- package/lib/core/runners/distributed-execution/process-task.js +45 -0
- package/lib/core/runners/distributed-execution/process-task.js.map +1 -0
- package/lib/core/runners/distributed-execution/process-tasks.d.ts +7 -0
- package/lib/core/runners/distributed-execution/process-tasks.js +67 -0
- package/lib/core/runners/distributed-execution/process-tasks.js.map +1 -0
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.d.ts +2 -0
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js +37 -0
- package/lib/core/runners/distributed-execution/split-task-graph-into-stages.js.map +1 -0
- package/lib/core/runners/distributed-execution/task-graph-creator.d.ts +17 -0
- package/lib/core/runners/distributed-execution/task-graph-creator.js +100 -0
- package/lib/core/runners/distributed-execution/task-graph-creator.js.map +1 -0
- package/lib/core/terminal-output/end-of-run-message.d.ts +2 -1
- package/lib/core/terminal-output/end-of-run-message.js +18 -10
- package/lib/core/terminal-output/end-of-run-message.js.map +1 -1
- package/lib/core/terminal-output/read-task-terminal-output.d.ts +2 -0
- package/lib/core/terminal-output/read-task-terminal-output.js +60 -0
- package/lib/core/terminal-output/read-task-terminal-output.js.map +1 -0
- package/lib/daemon/process-run-end.d.ts +3 -0
- package/lib/daemon/process-run-end.js +66 -0
- package/lib/daemon/process-run-end.js.map +1 -0
- package/lib/generators/init/init.d.ts +1 -2
- package/lib/generators/init/init.js +33 -56
- package/lib/generators/init/init.js.map +1 -1
- package/lib/generators/init/schema.json +5 -0
- package/lib/nx-cloud-tasks-runner.js +83 -25
- package/lib/nx-cloud-tasks-runner.js.map +1 -1
- package/lib/utilities/axios.d.ts +2 -1
- package/lib/utilities/axios.js +26 -12
- package/lib/utilities/axios.js.map +1 -1
- package/lib/utilities/create-unchanged-value-timeout.d.ts +4 -0
- package/lib/utilities/{create-no-new-messages-timeout.js → create-unchanged-value-timeout.js} +6 -7
- package/lib/utilities/create-unchanged-value-timeout.js.map +1 -0
- package/lib/utilities/distributed-task-execution-detection.d.ts +2 -0
- package/lib/utilities/distributed-task-execution-detection.js +36 -0
- package/lib/utilities/distributed-task-execution-detection.js.map +1 -0
- package/lib/utilities/dte-artifact-storage.d.ts +7 -0
- package/lib/utilities/dte-artifact-storage.js +43 -0
- package/lib/utilities/dte-artifact-storage.js.map +1 -0
- package/lib/utilities/environment.d.ts +11 -7
- package/lib/utilities/environment.js +97 -33
- package/lib/utilities/environment.js.map +1 -1
- package/lib/utilities/is-ci.d.ts +1 -0
- package/lib/utilities/is-ci.js +21 -0
- package/lib/utilities/is-ci.js.map +1 -0
- package/lib/utilities/metric-logger.js +2 -2
- package/lib/utilities/metric-logger.js.map +1 -1
- package/lib/utilities/nx-imports.js +54 -33
- package/lib/utilities/nx-imports.js.map +1 -1
- package/lib/utilities/print-message.js +40 -11
- package/lib/utilities/print-message.js.map +1 -1
- package/lib/utilities/serializer-overrides.d.ts +3 -0
- package/lib/utilities/serializer-overrides.js +44 -0
- package/lib/utilities/serializer-overrides.js.map +1 -0
- package/package.json +7 -6
- package/project.json +37 -0
- package/tsconfig.lib.json +1 -1
- package/tsconfig.spec.json +2 -1
- package/collection.json +0 -22
- package/lib/utilities/create-no-new-messages-timeout.d.ts +0 -1
- package/lib/utilities/create-no-new-messages-timeout.js.map +0 -1
package/bin/nx-cloud.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const distributed_agent_impl_1 = require("../lib/core/runners/distributed-agent/distributed-agent.impl");
|
|
5
|
-
const start_ci_run_1 = require("../lib/core/commands/start-ci-run");
|
|
6
|
-
const stop_all_agents_1 = require("../lib/core/commands/stop-all-agents");
|
|
7
4
|
const clean_up_agents_1 = require("../lib/core/commands/clean-up-agents");
|
|
8
5
|
const record_output_1 = require("../lib/core/commands/record-output");
|
|
6
|
+
const start_ci_run_1 = require("../lib/core/commands/start-ci-run");
|
|
7
|
+
const stop_all_agents_1 = require("../lib/core/commands/stop-all-agents");
|
|
8
|
+
const distributed_agent_impl_1 = require("../lib/core/runners/distributed-agent/distributed-agent.impl");
|
|
9
|
+
const upload_and_show_run_details_1 = require("../lib/core/commands/upload-and-show-run-details");
|
|
9
10
|
const command = process.argv[2];
|
|
10
11
|
if (command === 'start-agent') {
|
|
11
12
|
(0, distributed_agent_impl_1.startAgent)().catch((e) => {
|
|
@@ -37,6 +38,12 @@ else if (command === 'record') {
|
|
|
37
38
|
process.exit(1);
|
|
38
39
|
});
|
|
39
40
|
}
|
|
41
|
+
else if (command === 'upload-and-show-run-details') {
|
|
42
|
+
(0, upload_and_show_run_details_1.uploadAndShowRunDetails)().catch((e) => {
|
|
43
|
+
console.error(e);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
40
47
|
else {
|
|
41
48
|
console.log('Pass start-agent, stop-all-agents, or clean-up-agents');
|
|
42
49
|
}
|
package/bin/nx-cloud.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-cloud.js","sourceRoot":"","sources":["../../../../../libs/nx-packages/nx-cloud/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;KAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;IAC/B,IAAA,yCAAyB,GAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACtC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACJ;KAAM,IAAI,OAAO,KAAK,6BAA6B,EAAE;IACpD,IAAA,qDAAuB,GAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,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"}
|
package/generators.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Nx Cloud",
|
|
3
|
+
"version": "0.1",
|
|
4
|
+
"generators": {
|
|
5
|
+
"init": {
|
|
6
|
+
"factory": "./lib/generators/init/init#generator",
|
|
7
|
+
"schema": "./lib/generators/init/schema.json",
|
|
8
|
+
"description": "Initialize the @nrwl/nx-cloud plugin",
|
|
9
|
+
"hidden": true
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-reporter.api.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/api/error-reporter.api.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAG+B;AAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAEzD,MAAa,gBAAgB;IAG3B,YAAY,OAA+B;QACzC,IAAI,CAAC,gBAAgB,GAAG,IAAA,8BAAsB,EAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IAEK,WAAW,CAAC,OAAe;;YAC/B,IAAI;gBACF,MAAM,IAAA,0BAAkB,EAAC,GAAG,EAAE,CAC5B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,+BAA+B,EAAE;oBAC1D,OAAO;iBACR,CAAC,CACH,CAAC;aACH;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,CAAC,IAAI,CAAC;oBACV,KAAK,EAAE,0CAA0C,OAAO,GAAG;oBAC3D,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;iBACvB,CAAC,CAAC;aACJ;QACH,CAAC;KAAA;CACF;AArBD,4CAqBC"}
|
|
@@ -2,6 +2,6 @@ import { CloudTaskRunnerOptions } from '../models/cloud-task-runner-options';
|
|
|
2
2
|
export declare class RunGroupApi {
|
|
3
3
|
private apiAxiosInstance;
|
|
4
4
|
constructor(options: CloudTaskRunnerOptions);
|
|
5
|
-
createRunGroup(branch: string | null, runGroup: string): Promise<void>;
|
|
6
|
-
completeRunGroup(runGroup: string): Promise<void>;
|
|
5
|
+
createRunGroup(branch: string | null, runGroup: string, ciExecutionId: string | null, ciExecutionEnv: string, stopAgentsOnFailure?: boolean, agentCount?: number, stopAgentsAfter?: string): Promise<void>;
|
|
6
|
+
completeRunGroup(branch: string | null, runGroup: string, ciExecutionId: string | null, ciExecutionEnv: string): Promise<void>;
|
|
7
7
|
}
|
|
@@ -1 +1,73 @@
|
|
|
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 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, ciExecutionId, ciExecutionEnv, 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
|
+
ciExecutionId,
|
|
29
|
+
ciExecutionEnv,
|
|
30
|
+
stopAgentsOnFailure,
|
|
31
|
+
agentCount,
|
|
32
|
+
stopAgentsAfter,
|
|
33
|
+
}));
|
|
34
|
+
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
38
|
+
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
39
|
+
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
40
|
+
output.error({
|
|
41
|
+
title: e.message,
|
|
42
|
+
});
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
completeRunGroup(branch, runGroup, ciExecutionId, ciExecutionEnv) {
|
|
48
|
+
var _a;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const recorder = (0, metric_logger_1.createMetricRecorder)('createRunGroup');
|
|
51
|
+
try {
|
|
52
|
+
const resp = yield (0, axios_1.axiosMultipleTries)(() => this.apiAxiosInstance.post('/nx-cloud/executions/complete-run-group', {
|
|
53
|
+
branch,
|
|
54
|
+
runGroup,
|
|
55
|
+
ciExecutionId,
|
|
56
|
+
ciExecutionEnv,
|
|
57
|
+
}));
|
|
58
|
+
recorder.recordMetric((0, metric_logger_1.mapRespToPerfEntry)(resp));
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
recorder.recordMetric(((_a = e === null || e === void 0 ? void 0 : e.axiosException) === null || _a === void 0 ? void 0 : _a.response)
|
|
62
|
+
? (0, metric_logger_1.mapRespToPerfEntry)(e.axiosException.response)
|
|
63
|
+
: metric_logger_1.RUNNER_FAILURE_PERF_ENTRY);
|
|
64
|
+
output.error({
|
|
65
|
+
title: e.message,
|
|
66
|
+
});
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.RunGroupApi = RunGroupApi;
|
|
73
|
+
//# sourceMappingURL=run-group.api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-group.api.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/api/run-group.api.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"run-group.api.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/api/run-group.api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAG+B;AAC/B,iEAIuC;AAGvC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAEzD,MAAa,WAAW;IAGtB,YAAY,OAA+B;QACzC,IAAI,CAAC,gBAAgB,GAAG,I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;oBACN,QAAQ;oBACR,aAAa;oBACb,cAAc;iBACf,CAAC,CACH,CAAC;gBACF,QAAQ,CAAC,YAAY,CAAC,IAAA,kCAAkB,EAAC,IAAI,CAAC,CAAC,CAAC;aACjD;YAAC,OAAO,CAAM,EAAE;gBACf,QAAQ,CAAC,YAAY,CACnB,CAAA,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,cAAc,0CAAE,QAAQ;oBACzB,CAAC,CAAC,IAAA,kCAAkB,EAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC;oBAC/C,CAAC,CAAC,yCAAyB,CAC9B,CAAC;gBAEF,MAAM,CAAC,KAAK,CAAC;oBACX,KAAK,EAAE,CAAC,CAAC,OAAO;iBACjB,CAAC,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;;KACF;CACF;AA3ED,kCA2EC"}
|
|
@@ -13,11 +13,11 @@ exports.cleanUpAgents = void 0;
|
|
|
13
13
|
const stripJsonComments = require("strip-json-comments");
|
|
14
14
|
const environment_1 = require("../../utilities/environment");
|
|
15
15
|
const fs_1 = require("fs");
|
|
16
|
-
const { output } = require('../../utilities/nx-imports');
|
|
16
|
+
const { output, workspaceRoot } = require('../../utilities/nx-imports');
|
|
17
17
|
function cleanUpAgents() {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const options = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(
|
|
20
|
-
const cacheDirectory = options
|
|
19
|
+
const options = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString())).tasksRunnerOptions.default.options;
|
|
20
|
+
const cacheDirectory = (0, environment_1.getNxCacheDirectory)(options);
|
|
21
21
|
const lockFileDirectory = `${cacheDirectory}/lockfiles`;
|
|
22
22
|
if (environment_1.VERBOSE_LOGGING) {
|
|
23
23
|
output.note({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-up-agents.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/clean-up-agents.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"clean-up-agents.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/clean-up-agents.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyD;AACzD,6DAGqC;AACrC,2BAAsC;AAEtC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAExE,SAAsB,aAAa;;QACjC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,iBAAiB,CAAC,IAAA,iBAAY,EAAC,GAAG,aAAa,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,CACvE,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;QACrC,MAAM,cAAc,GAAG,IAAA,iCAAmB,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,iBAAiB,GAAG,GAAG,cAAc,YAAY,CAAC;QAExD,IAAI,6BAAe,EAAE;YACnB,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,gDAAgD;aACxD,CAAC,CAAC;SACJ;QAED,OAAO,IAAA,OAAE,EAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;YACrE,IAAI,GAAG;gBAAE,MAAM,GAAG,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAhBD,sCAgBC"}
|
|
@@ -1,16 +1 @@
|
|
|
1
1
|
export declare function runCommandAndStoreInCloud(): Promise<void>;
|
|
2
|
-
/**
|
|
3
|
-
* https://github.com/nrwl/nx/blob/master/packages/nx/src/utils/find-workspace-root.ts
|
|
4
|
-
* Recursive function that walks back up the directory
|
|
5
|
-
* tree to try and find a workspace file.
|
|
6
|
-
*
|
|
7
|
-
* @param dir Directory to start searching with
|
|
8
|
-
*/
|
|
9
|
-
export declare function findWorkspaceRoot(dir: string): WorkspaceTypeAndRoot | null;
|
|
10
|
-
/**
|
|
11
|
-
* https://github.com/nrwl/nx/blob/master/packages/nx/src/utils/find-workspace-root.ts
|
|
12
|
-
*/
|
|
13
|
-
export interface WorkspaceTypeAndRoot {
|
|
14
|
-
type: 'nx' | 'angular';
|
|
15
|
-
dir: string;
|
|
16
|
-
}
|
|
@@ -9,43 +9,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.runCommandAndStoreInCloud = void 0;
|
|
13
13
|
const cp = require("child_process");
|
|
14
|
-
const fs_1 = require("fs");
|
|
15
|
-
const path = require("path");
|
|
16
14
|
const environment_1 = require("../../utilities/environment");
|
|
17
15
|
const axios_1 = require("../../utilities/axios");
|
|
18
16
|
const util_1 = require("util");
|
|
19
17
|
const zlib_1 = require("zlib");
|
|
20
18
|
const output_obfuscator_1 = require("../terminal-output/output-obfuscator");
|
|
21
19
|
const print_message_1 = require("../../utilities/print-message");
|
|
22
|
-
const
|
|
20
|
+
const distributed_execution_api_1 = require("../runners/distributed-execution/distributed-execution.api");
|
|
21
|
+
const { output, workspaceRoot } = require('../../utilities/nx-imports');
|
|
23
22
|
const MAX_CHARACTERS_OUTPUT_CAPTURE = 200000;
|
|
24
23
|
function runCommandAndStoreInCloud() {
|
|
25
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
25
|
const taskRunnerOptions = getTaskRunnerOptions();
|
|
27
26
|
const axios = (0, axios_1.createApiAxiosInstance)(taskRunnerOptions);
|
|
27
|
+
const dteApi = new distributed_execution_api_1.DistributedExecutionApi(taskRunnerOptions);
|
|
28
28
|
const outputObfuscator = new output_obfuscator_1.OutputObfuscator(taskRunnerOptions.maskedProperties);
|
|
29
29
|
const branch = (0, environment_1.getBranch)();
|
|
30
30
|
const runGroup = (0, environment_1.getRunGroup)();
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
// Different package managers may remove not the "--" from the command automatically, so account for that
|
|
35
|
-
const sliceOffset = process.argv[commandStartIndex] === '--' ? 1 : 0;
|
|
36
|
-
userCommandAndArgs = process.argv.slice(commandStartIndex + sliceOffset);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
console.log('Invalid command. Use `nx-cloud record [my command] [my arg1] [my arg...]`');
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
31
|
+
const ciExecutionId = (0, environment_1.getCIExecutionId)();
|
|
32
|
+
const ciExecutionEnv = (0, environment_1.getCIExecutionEnv)();
|
|
33
|
+
const userCommandAndArgs = parseCommandAndFlags(process.argv);
|
|
42
34
|
const [userCommand, ...userArgs] = userCommandAndArgs;
|
|
43
|
-
const startRecordRunRequest = {
|
|
44
|
-
branch,
|
|
45
|
-
runGroup,
|
|
46
|
-
hashes: [],
|
|
47
|
-
};
|
|
48
|
-
yield (0, axios_1.axiosMultipleTries)(() => axios.post('/nx-cloud/runs/start', startRecordRunRequest));
|
|
49
35
|
const startTime = new Date().toISOString();
|
|
50
36
|
const { statusCode, terminalOutput } = yield spawnUserCommandAndCaptureOutput(userCommand, userArgs);
|
|
51
37
|
const endTime = new Date().toISOString();
|
|
@@ -57,30 +43,37 @@ function runCommandAndStoreInCloud() {
|
|
|
57
43
|
endTime,
|
|
58
44
|
branch,
|
|
59
45
|
runGroup,
|
|
46
|
+
ciExecutionId,
|
|
47
|
+
ciExecutionEnv,
|
|
60
48
|
};
|
|
61
|
-
yield endRecordOutputRun(axios, outputObfuscator, taskRunnerOptions, endRecordOutputRunParams);
|
|
49
|
+
yield endRecordOutputRun(axios, outputObfuscator, taskRunnerOptions, endRecordOutputRunParams, dteApi);
|
|
62
50
|
process.exit(statusCode);
|
|
63
51
|
});
|
|
64
52
|
}
|
|
65
53
|
exports.runCommandAndStoreInCloud = runCommandAndStoreInCloud;
|
|
66
54
|
function getTaskRunnerOptions() {
|
|
67
55
|
var _a, _b, _c;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
throw new Error('Unable to locate task runner options.');
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
const taskRunnerOptions = (_c = (_b = (_a = require(`${workspaceRoot.dir}/nx.json`)) === null || _a === void 0 ? void 0 : _a.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) === null || _c === void 0 ? void 0 : _c.options;
|
|
56
|
+
try {
|
|
57
|
+
const taskRunnerOptions = (_c = (_b = (_a = require(`${workspaceRoot}/nx.json`)) === null || _a === void 0 ? void 0 : _a.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) === null || _c === void 0 ? void 0 : _c.options;
|
|
74
58
|
return taskRunnerOptions;
|
|
75
59
|
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
throw new Error('Unable to locate task runner options.');
|
|
62
|
+
}
|
|
76
63
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
let
|
|
80
|
-
if (
|
|
81
|
-
|
|
64
|
+
function parseCommandAndFlags(args) {
|
|
65
|
+
let commandStartIndex = args.findIndex((arg) => arg === 'record') + 1;
|
|
66
|
+
let userCommandAndArgs;
|
|
67
|
+
if (commandStartIndex < process.argv.length) {
|
|
68
|
+
// Different package managers may remove not the "--" from the command automatically, so account for that
|
|
69
|
+
const sliceOffset = process.argv[commandStartIndex] === '--' ? 1 : 0;
|
|
70
|
+
userCommandAndArgs = process.argv.slice(commandStartIndex + sliceOffset);
|
|
82
71
|
}
|
|
83
|
-
|
|
72
|
+
else {
|
|
73
|
+
console.log('Invalid command. Use `nx-cloud record [my command] [my arg1] [my arg...]`');
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
return userCommandAndArgs;
|
|
84
77
|
}
|
|
85
78
|
function spawnUserCommandAndCaptureOutput(command, args) {
|
|
86
79
|
return new Promise((res, rej) => {
|
|
@@ -130,7 +123,7 @@ function createTaskDefinitionFromUserCommand(outputObfuscator, params) {
|
|
|
130
123
|
terminalOutput: truncatedOutput,
|
|
131
124
|
};
|
|
132
125
|
}
|
|
133
|
-
function endRecordOutputRun(axios, obfuscator, taskRunnerOptions, params) {
|
|
126
|
+
function endRecordOutputRun(axios, obfuscator, taskRunnerOptions, params, dteApi) {
|
|
134
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
128
|
const commandWithPrefix = `nx-cloud record -- ${params.userCommandAndArgsString}`;
|
|
136
129
|
const endRunReq = {
|
|
@@ -143,8 +136,9 @@ function endRecordOutputRun(axios, obfuscator, taskRunnerOptions, params) {
|
|
|
143
136
|
startTime: params.startTime,
|
|
144
137
|
endTime: params.endTime,
|
|
145
138
|
branch: params.branch,
|
|
146
|
-
scan: true,
|
|
147
139
|
runGroup: params.runGroup,
|
|
140
|
+
ciExecutionId: params.ciExecutionId,
|
|
141
|
+
ciExecutionEnv: params.ciExecutionEnv,
|
|
148
142
|
// only set sha if branch is set because we invoke a separate process,
|
|
149
143
|
// which adds a few millis
|
|
150
144
|
sha: params.branch ? (0, environment_1.extractGitSha)() : undefined,
|
|
@@ -156,7 +150,12 @@ function endRecordOutputRun(axios, obfuscator, taskRunnerOptions, params) {
|
|
|
156
150
|
const endRunResp = yield (0, axios_1.axiosMultipleTries)(() => axios.post('/nx-cloud/runs/end', compressedBuffer, {
|
|
157
151
|
headers: Object.assign(Object.assign({}, axios.defaults.headers), { 'Content-Encoding': 'gzip', 'Content-Type': 'application/octet-stream' }),
|
|
158
152
|
}));
|
|
159
|
-
|
|
153
|
+
if (process.env.NX_CLOUD_SILENT_RECORD !== 'true') {
|
|
154
|
+
printRecordOutputRunEndMessage(endRunResp.data.runUrl);
|
|
155
|
+
}
|
|
156
|
+
if (params.statusCode !== 0 && params.runGroup) {
|
|
157
|
+
yield dteApi.completeRunGroupWithError(params.branch, params.runGroup, params.ciExecutionId, params.ciExecutionEnv, `Command "${params.userCommandAndArgsString}" failed.`);
|
|
158
|
+
}
|
|
160
159
|
});
|
|
161
160
|
}
|
|
162
161
|
function printRecordOutputRunEndMessage(runUrl) {
|
|
@@ -166,26 +165,6 @@ function printRecordOutputRunEndMessage(runUrl) {
|
|
|
166
165
|
}
|
|
167
166
|
// Everything from here down is ripped from the nx package
|
|
168
167
|
// You probably don't want to adjust this manually
|
|
169
|
-
/**
|
|
170
|
-
* https://github.com/nrwl/nx/blob/master/packages/nx/src/utils/find-workspace-root.ts
|
|
171
|
-
* Recursive function that walks back up the directory
|
|
172
|
-
* tree to try and find a workspace file.
|
|
173
|
-
*
|
|
174
|
-
* @param dir Directory to start searching with
|
|
175
|
-
*/
|
|
176
|
-
function findWorkspaceRoot(dir) {
|
|
177
|
-
if ((0, fs_1.existsSync)(path.join(dir, 'angular.json'))) {
|
|
178
|
-
return { type: 'angular', dir };
|
|
179
|
-
}
|
|
180
|
-
if ((0, fs_1.existsSync)(path.join(dir, 'nx.json'))) {
|
|
181
|
-
return { type: 'nx', dir };
|
|
182
|
-
}
|
|
183
|
-
if (path.dirname(dir) === dir) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
return findWorkspaceRoot(path.dirname(dir));
|
|
187
|
-
}
|
|
188
|
-
exports.findWorkspaceRoot = findWorkspaceRoot;
|
|
189
168
|
/**
|
|
190
169
|
* https://github.com/nrwl/nx/blob/master/packages/nx/src/tasks-runner/forked-process-task-runner.ts
|
|
191
170
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-output.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/record-output.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"record-output.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/record-output.ts"],"names":[],"mappings":";;;;;;;;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CAAC;AAED,0DAA0D;AAC1D,kDAAkD;AAClD;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,GAAG,GAAG,CAAC,CAAC;IACxC,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,GAAG,GAAG,CAAC,CAAC;IACxC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,GAAG,EAAE,CAAC;IAC1C,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -15,23 +15,45 @@ const environment_1 = require("../../utilities/environment");
|
|
|
15
15
|
const print_run_group_error_1 = require("../error/print-run-group-error");
|
|
16
16
|
const run_group_api_1 = require("../api/run-group.api");
|
|
17
17
|
const fs_1 = require("fs");
|
|
18
|
-
const
|
|
18
|
+
const yargsParser = require("yargs-parser");
|
|
19
|
+
const distributed_task_execution_detection_1 = require("../../utilities/distributed-task-execution-detection");
|
|
20
|
+
const { output, workspaceRoot } = require('../../utilities/nx-imports');
|
|
21
|
+
const args = yargsParser(process.argv, {
|
|
22
|
+
boolean: ['stop-agents-on-failure', 'use-dte-by-default'],
|
|
23
|
+
number: ['agent-count', 'command-count'],
|
|
24
|
+
string: ['stop-agents-after'],
|
|
25
|
+
default: {
|
|
26
|
+
useDteByDefault: true,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
19
29
|
function startCiRun() {
|
|
20
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
31
|
const branch = (0, environment_1.getBranch)();
|
|
22
32
|
const runGroup = (0, environment_1.getRunGroup)();
|
|
23
|
-
|
|
33
|
+
const ciExecutionId = (0, environment_1.getCIExecutionId)();
|
|
34
|
+
const ciExecutionEnv = (0, environment_1.getCIExecutionEnv)();
|
|
35
|
+
if (!(0, print_run_group_error_1.canDetectRunGroup)(runGroup, ciExecutionId)) {
|
|
24
36
|
(0, print_run_group_error_1.printRunGroupError)();
|
|
25
37
|
process.exit(1);
|
|
26
38
|
}
|
|
27
39
|
if (environment_1.VERBOSE_LOGGING) {
|
|
28
40
|
output.note({
|
|
29
|
-
title: `Creating run group ${runGroup}`,
|
|
41
|
+
title: `Creating run group. branch: ${branch}, ciExecutionId: ${ciExecutionId}, ciExecutionEnv: ${ciExecutionEnv}, runGroup: ${runGroup}`,
|
|
30
42
|
});
|
|
31
43
|
}
|
|
32
|
-
|
|
44
|
+
if (args.commandCount) {
|
|
45
|
+
output.error({
|
|
46
|
+
title: `--command-count is deprecated. Use --stop-agents-after instead.`,
|
|
47
|
+
bodyLines: [`E.g., npx nx-cloud start-ci-run --stop-agents-after="e2e"`],
|
|
48
|
+
});
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const options = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString())).tasksRunnerOptions.default.options;
|
|
33
52
|
const api = new run_group_api_1.RunGroupApi(options);
|
|
34
|
-
yield api.createRunGroup(branch, runGroup);
|
|
53
|
+
yield api.createRunGroup(branch, runGroup, ciExecutionId, ciExecutionEnv, args.stopAgentsOnFailure, args.agentCount, args.stopAgentsAfter);
|
|
54
|
+
if (args.useDteByDefault) {
|
|
55
|
+
(0, distributed_task_execution_detection_1.storeDteMarker)();
|
|
56
|
+
}
|
|
35
57
|
});
|
|
36
58
|
}
|
|
37
59
|
exports.startCiRun = startCiRun;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-ci-run.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/start-ci-run.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"start-ci-run.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/start-ci-run.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyD;AACzD,6DAMqC;AACrC,0EAGwC;AACxC,wDAAmD;AACnD,2BAAkC;AAClC,4CAA4C;AAC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AAC,CACvE,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;QAErC,MAAM,GAAG,GAAG,IAAI,2BAAW,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,GAAG,CAAC,cAAc,CACtB,MAAM,EACN,QAAQ,EACR,aAAa,EACb,cAAc,EACd,IAAI,CAAC,mBAAmB,EACxB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,eAAe,CACrB,CAAC;QAEF,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAA,qDAAc,GAAE,CAAC;SAClB;IACH,CAAC;CAAA;AA3CD,gCA2CC"}
|
|
@@ -18,19 +18,22 @@ const fs_1 = require("fs");
|
|
|
18
18
|
const { output } = require('../../utilities/nx-imports');
|
|
19
19
|
function stopAllAgents() {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const branch = (0, environment_1.getBranch)();
|
|
21
22
|
const runGroup = (0, environment_1.getRunGroup)();
|
|
22
|
-
|
|
23
|
+
const ciExecutionId = (0, environment_1.getCIExecutionId)();
|
|
24
|
+
const ciExecutionEnv = (0, environment_1.getCIExecutionEnv)();
|
|
25
|
+
if (!(0, print_run_group_error_1.canDetectRunGroup)(runGroup, ciExecutionId)) {
|
|
23
26
|
(0, print_run_group_error_1.printRunGroupError)();
|
|
24
27
|
process.exit(1);
|
|
25
28
|
}
|
|
26
29
|
if (environment_1.VERBOSE_LOGGING) {
|
|
27
30
|
output.note({
|
|
28
|
-
title: `Stopping all agents running tasks for run group ${runGroup}`,
|
|
31
|
+
title: `Stopping all agents running tasks for run group. branch: ${branch}, ciExecutionId: ${ciExecutionId}, ciExecutionEnv: ${ciExecutionEnv}, runGroup: ${runGroup}`,
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
34
|
const options = JSON.parse(stripJsonComments((0, fs_1.readFileSync)('nx.json').toString())).tasksRunnerOptions.default.options;
|
|
32
35
|
const api = new run_group_api_1.RunGroupApi(options);
|
|
33
|
-
yield api.completeRunGroup(runGroup);
|
|
36
|
+
yield api.completeRunGroup(branch, runGroup, ciExecutionId, ciExecutionEnv);
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
exports.stopAllAgents = stopAllAgents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop-all-agents.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/stop-all-agents.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"stop-all-agents.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/stop-all-agents.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyD;AACzD,6DAMqC;AACrC,0EAGwC;AACxC,wDAAmD;AACnD,2BAAkC;AAClC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAEzD,SAAsB,aAAa;;QACjC,MAAM,MAAM,GAAG,IAAA,uBAAS,GAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAA,8BAAgB,GAAE,CAAC;QACzC,MAAM,cAAc,GAAG,IAAA,+BAAiB,GAAE,CAAC;QAE3C,IAAI,CAAC,IAAA,yCAAiB,EAAC,QAAQ,EAAE,aAAa,CAAC,EAAE;YAC/C,IAAA,0CAAkB,GAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;QAED,IAAI,6BAAe,EAAE;YACnB,MAAM,CAAC,IAAI,CAAC;gBACV,KAAK,EAAE,4DAA4D,MAAM,oBAAoB,aAAa,qBAAqB,cAAc,eAAe,QAAQ,EAAE;aACvK,CAAC,CAAC;SACJ;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,iBAAiB,CAAC,IAAA,iBAAY,EAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CACtD,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;QAErC,MAAM,GAAG,GAAG,IAAI,2BAAW,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,GAAG,CAAC,gBAAgB,CAAC,MAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;IAChF,CAAC;CAAA;AAtBD,sCAsBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function uploadAndShowRunDetails(): Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
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.uploadAndShowRunDetails = void 0;
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const open = require("open");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
const environment_1 = require("../../utilities/environment");
|
|
17
|
+
const cloud_run_api_1 = require("../runners/cloud-enabled/cloud-run.api");
|
|
18
|
+
const id_generator_1 = require("../runners/cloud-enabled/id-generator");
|
|
19
|
+
const message_reporter_1 = require("../terminal-output/message-reporter");
|
|
20
|
+
const output_obfuscator_1 = require("../terminal-output/output-obfuscator");
|
|
21
|
+
const read_task_terminal_output_1 = require("../terminal-output/read-task-terminal-output");
|
|
22
|
+
const { workspaceRoot, output } = require('../../utilities/nx-imports');
|
|
23
|
+
function uploadRunDetails(options) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const errors = new message_reporter_1.MessageReporter(options);
|
|
26
|
+
const runContext = {};
|
|
27
|
+
const machineInfo = (0, environment_1.getMachineInfo)(options);
|
|
28
|
+
const api = new cloud_run_api_1.CloudRunApi(errors, runContext, options, machineInfo);
|
|
29
|
+
const directory = (0, environment_1.getNxCacheDirectory)(options);
|
|
30
|
+
const outputObfusactor = new output_obfuscator_1.OutputObfuscator(options.maskedProperties);
|
|
31
|
+
const runInfo = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(directory, 'run.json')).toString());
|
|
32
|
+
// we need to connect to cloud if not connected yet
|
|
33
|
+
const tasks = runInfo.tasks.map((t) => (Object.assign(Object.assign({}, t), { terminalOutput: (0, read_task_terminal_output_1.readTaskTerminalOutput)(directory, outputObfusactor, t.hash, t.cacheStatus, t.status) })));
|
|
34
|
+
const linkId = (0, id_generator_1.generateUniqueLinkId)();
|
|
35
|
+
yield api.endRun(runInfo.run, tasks, {
|
|
36
|
+
branch: null,
|
|
37
|
+
runGroup: null,
|
|
38
|
+
ciExecutionId: null,
|
|
39
|
+
ciExecutionEnv: null,
|
|
40
|
+
}, linkId);
|
|
41
|
+
return `${options.url || 'https://nx.app'}/runs/${linkId}`;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function uploadAndShowRunDetails() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const options = readOptions();
|
|
47
|
+
const url = yield uploadRunDetails(options);
|
|
48
|
+
output.success({
|
|
49
|
+
title: 'Successfully uploaded the run details',
|
|
50
|
+
bodyLines: [`View run details at ${url}`],
|
|
51
|
+
});
|
|
52
|
+
open(url);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.uploadAndShowRunDetails = uploadAndShowRunDetails;
|
|
56
|
+
function readOptions() {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
try {
|
|
59
|
+
return (_c = (_b = (_a = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(workspaceRoot, 'nx.json')).toString())) === null || _a === void 0 ? void 0 : _a.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) === null || _c === void 0 ? void 0 : _c.options;
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=upload-and-show-run-details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-and-show-run-details.js","sourceRoot":"","sources":["../../../../../../../libs/nx-packages/nx-cloud/lib/core/commands/upload-and-show-run-details.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAkC;AAClC,6BAA6B;AAC7B,+BAA4B;AAC5B,6DAGqC;AAErC,0EAAqE;AACrE,wEAA6E;AAC7E,0EAAsE;AACtE,4EAAwE;AACxE,4FAAsF;AAEtF,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAExE,SAAe,gBAAgB,CAAC,OAA+B;;QAC7D,MAAM,MAAM,GAAG,IAAI,kCAAe,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,EAAS,CAAC;QAC7B,MAAM,WAAW,GAAG,IAAA,4BAAc,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,IAAI,2BAAW,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAEtE,MAAM,SAAS,GAAG,IAAA,iCAAmB,EAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,gBAAgB,GAAG,IAAI,oCAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAExE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,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