bdy 1.19.2-dev-pipeline → 1.19.4-dev-pipeline
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/distTs/package.json +1 -1
- package/distTs/src/output/pipeline.js +43 -15
- package/package.json +1 -1
package/distTs/package.json
CHANGED
|
@@ -22,6 +22,7 @@ var MODE;
|
|
|
22
22
|
MODE["RUN"] = "RUN";
|
|
23
23
|
MODE["ACTION"] = "ACTION";
|
|
24
24
|
})(MODE || (MODE = {}));
|
|
25
|
+
const LOGS_LIMIT = 1000;
|
|
25
26
|
class OutputPipeline {
|
|
26
27
|
static async runLogs(client, workspace, project, pipelineId, runId, runActionId, noWait) {
|
|
27
28
|
if (output_1.default.isTTY() && !noWait) {
|
|
@@ -118,6 +119,9 @@ class OutputPipeline {
|
|
|
118
119
|
static _runLogsHeader() {
|
|
119
120
|
return `${output_1.default.getTermKitBlueColor('/')} ${output_1.default.getTermKitLabelColor('LOGS')}`;
|
|
120
121
|
}
|
|
122
|
+
static _runOutputHeader() {
|
|
123
|
+
return `${output_1.default.getTermKitBlueColor('/')} ${output_1.default.getTermKitLabelColor('OUTPUT')}`;
|
|
124
|
+
}
|
|
121
125
|
static _runDetailsStarted(status, started, delayed, tabs) {
|
|
122
126
|
if (delayed && status === pipeline_1.PIPELINE_RUN_STATUS.ENQUEUED) {
|
|
123
127
|
let str = ` ${output_1.default.getTermKitDimColor(this._fillString('Scheduled', tabs))}`;
|
|
@@ -154,7 +158,7 @@ class OutputPipeline {
|
|
|
154
158
|
if (end > logs.length)
|
|
155
159
|
end = logs.length;
|
|
156
160
|
for (let i = start; i < end; i += 1) {
|
|
157
|
-
str.push(
|
|
161
|
+
str.push(`${output_1.default.getTermKitDimColor(logs[i])}`);
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
164
|
else {
|
|
@@ -670,13 +674,22 @@ class OutputPipeline {
|
|
|
670
674
|
return help;
|
|
671
675
|
}
|
|
672
676
|
static _drawInteractiveAction(action, actionLogs, put, blank, opts) {
|
|
673
|
-
const fullActionLogs = [...actionLogs];
|
|
677
|
+
const fullActionLogs = [...actionLogs.map((str) => ` ${str}`)];
|
|
674
678
|
if (action?.outputtedVariables.length) {
|
|
675
679
|
if (actionLogs.length > 0)
|
|
676
680
|
fullActionLogs.push('');
|
|
677
|
-
fullActionLogs.push(
|
|
678
|
-
action.outputtedVariables.forEach((v) => {
|
|
679
|
-
|
|
681
|
+
fullActionLogs.push(this._runOutputHeader());
|
|
682
|
+
action.outputtedVariables.forEach((v, i) => {
|
|
683
|
+
let line = ' ';
|
|
684
|
+
if (i <= 0)
|
|
685
|
+
line += 'Variables ';
|
|
686
|
+
else
|
|
687
|
+
line += ' ';
|
|
688
|
+
line += output_1.default.getTermKitMutedColor(v.key);
|
|
689
|
+
line += ' = "';
|
|
690
|
+
line += output_1.default.getTermKitBlueColor(v.value);
|
|
691
|
+
line += '"';
|
|
692
|
+
fullActionLogs.push(line);
|
|
680
693
|
});
|
|
681
694
|
}
|
|
682
695
|
const tabs = 25;
|
|
@@ -1056,6 +1069,14 @@ class OutputPipeline {
|
|
|
1056
1069
|
draw();
|
|
1057
1070
|
}, true);
|
|
1058
1071
|
}
|
|
1072
|
+
static _exitByStatus(status) {
|
|
1073
|
+
if (status && [pipeline_1.PIPELINE_RUN_STATUS.FAILED, pipeline_1.PIPELINE_RUN_STATUS.TERMINATED].includes(status)) {
|
|
1074
|
+
process.exit(1);
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
process.exit(0);
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1059
1080
|
static async _runLogsNonInteractive(client, workspace, project, pipelineId, runId, runActionId, noWait) {
|
|
1060
1081
|
let action = null;
|
|
1061
1082
|
let actionLogsStart = 0;
|
|
@@ -1092,7 +1113,7 @@ class OutputPipeline {
|
|
|
1092
1113
|
}
|
|
1093
1114
|
if (drawnStart && logs && !logsEnd) {
|
|
1094
1115
|
for (; actionLogsStart < logs.length; actionLogsStart += 1) {
|
|
1095
|
-
output_1.default.normal(` ${logs[actionLogsStart]}`);
|
|
1116
|
+
output_1.default.normal(output_1.default.getTermKitDimColor(` ${logs[actionLogsStart]}`));
|
|
1096
1117
|
}
|
|
1097
1118
|
if (action &&
|
|
1098
1119
|
[
|
|
@@ -1102,7 +1123,7 @@ class OutputPipeline {
|
|
|
1102
1123
|
pipeline_1.PIPELINE_RUN_STATUS.SUCCESSFUL,
|
|
1103
1124
|
pipeline_1.PIPELINE_RUN_STATUS.TERMINATED,
|
|
1104
1125
|
].includes(action.status) &&
|
|
1105
|
-
actionLogsStart === lastActionLogsStart) {
|
|
1126
|
+
(actionLogsStart === lastActionLogsStart || logs.length < LOGS_LIMIT)) {
|
|
1106
1127
|
logsEnd = true;
|
|
1107
1128
|
}
|
|
1108
1129
|
lastActionLogsStart = actionLogsStart;
|
|
@@ -1110,9 +1131,17 @@ class OutputPipeline {
|
|
|
1110
1131
|
if (logsEnd || (drawnStart && noWait && logs)) {
|
|
1111
1132
|
if (logsEnd && action?.outputtedVariables.length) {
|
|
1112
1133
|
output_1.default.normal('');
|
|
1113
|
-
output_1.default.normal(
|
|
1114
|
-
|
|
1115
|
-
|
|
1134
|
+
output_1.default.normal(this._runOutputHeader());
|
|
1135
|
+
output_1.default.normal(output_1.default.getTermKitDimColor(' Variables '), false);
|
|
1136
|
+
action.outputtedVariables.forEach((v, i) => {
|
|
1137
|
+
let line = '';
|
|
1138
|
+
if (i > 0)
|
|
1139
|
+
line += ' ';
|
|
1140
|
+
line += output_1.default.getTermKitMutedColor(v.key);
|
|
1141
|
+
line += output_1.default.getTermKitDimColor(` = "`);
|
|
1142
|
+
line += output_1.default.getTermKitBlueColor(v.value);
|
|
1143
|
+
line += output_1.default.getTermKitDimColor('"');
|
|
1144
|
+
output_1.default.normal(line);
|
|
1116
1145
|
});
|
|
1117
1146
|
}
|
|
1118
1147
|
if (logsEnd && action && totalFetchesCount > 1) {
|
|
@@ -1136,7 +1165,7 @@ class OutputPipeline {
|
|
|
1136
1165
|
output_1.default.normal(finished);
|
|
1137
1166
|
}
|
|
1138
1167
|
}
|
|
1139
|
-
|
|
1168
|
+
this._exitByStatus(action?.status);
|
|
1140
1169
|
}
|
|
1141
1170
|
};
|
|
1142
1171
|
this._actionLogsLoop(client, workspace, project, pipelineId, runId, runActionId, draw)
|
|
@@ -1189,7 +1218,7 @@ class OutputPipeline {
|
|
|
1189
1218
|
totalFetchesCount += 1;
|
|
1190
1219
|
draw(run);
|
|
1191
1220
|
if (noWait) {
|
|
1192
|
-
|
|
1221
|
+
this._exitByStatus(run.status);
|
|
1193
1222
|
}
|
|
1194
1223
|
});
|
|
1195
1224
|
if (totalFetchesCount > 1) {
|
|
@@ -1203,19 +1232,18 @@ class OutputPipeline {
|
|
|
1203
1232
|
if (finished)
|
|
1204
1233
|
output_1.default.normal(finished);
|
|
1205
1234
|
}
|
|
1206
|
-
|
|
1235
|
+
this._exitByStatus(run.status);
|
|
1207
1236
|
}
|
|
1208
1237
|
static async _actionLogsLoop(client, workspace, project, pipelineId, runId, actionExecutionId, onChange) {
|
|
1209
1238
|
let logs = [];
|
|
1210
1239
|
let offset = 0;
|
|
1211
|
-
const limit = 1000;
|
|
1212
1240
|
let shouldCancel = false;
|
|
1213
1241
|
const cancel = () => {
|
|
1214
1242
|
shouldCancel = true;
|
|
1215
1243
|
};
|
|
1216
1244
|
onChange(logs, cancel);
|
|
1217
1245
|
const fetchLogs = async () => {
|
|
1218
|
-
return await client.getPipelineRunActionLogs(workspace, project, pipelineId, runId, actionExecutionId, offset,
|
|
1246
|
+
return await client.getPipelineRunActionLogs(workspace, project, pipelineId, runId, actionExecutionId, offset, LOGS_LIMIT);
|
|
1219
1247
|
};
|
|
1220
1248
|
for (;;) {
|
|
1221
1249
|
let o = await fetchLogs();
|