bdy 1.19.0-dev-pipeline → 1.19.1-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 +31 -11
- package/package.json +1 -1
package/distTs/package.json
CHANGED
|
@@ -21,7 +21,6 @@ var MODE;
|
|
|
21
21
|
(function (MODE) {
|
|
22
22
|
MODE["RUN"] = "RUN";
|
|
23
23
|
MODE["ACTION"] = "ACTION";
|
|
24
|
-
MODE["APPROVE"] = "APPROVE";
|
|
25
24
|
})(MODE || (MODE = {}));
|
|
26
25
|
class OutputPipeline {
|
|
27
26
|
static async runLogs(client, workspace, project, pipelineId, runId, runActionId, noWait) {
|
|
@@ -53,12 +52,7 @@ class OutputPipeline {
|
|
|
53
52
|
].includes(status);
|
|
54
53
|
}
|
|
55
54
|
static _canApprove(status) {
|
|
56
|
-
return [
|
|
57
|
-
pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_APPLY,
|
|
58
|
-
pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VT_SESSION,
|
|
59
|
-
pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VARIABLES,
|
|
60
|
-
pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VT_SESSION,
|
|
61
|
-
].includes(status);
|
|
55
|
+
return [pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_APPLY].includes(status);
|
|
62
56
|
}
|
|
63
57
|
static _fillString(str, length) {
|
|
64
58
|
if (str.length >= length - 1)
|
|
@@ -540,7 +534,7 @@ class OutputPipeline {
|
|
|
540
534
|
}
|
|
541
535
|
static _runDetailsId(id, tabs) {
|
|
542
536
|
let str = ` ${output_1.default.getTermKitDimColor(this._fillString('ID', tabs))}`;
|
|
543
|
-
str += output_1.default.getTermKitMutedColor(id);
|
|
537
|
+
str += output_1.default.getTermKitMutedColor(String(id));
|
|
544
538
|
return str;
|
|
545
539
|
}
|
|
546
540
|
static runStatusText(status) {
|
|
@@ -770,6 +764,14 @@ class OutputPipeline {
|
|
|
770
764
|
put(this._runInteractiveHelp(run));
|
|
771
765
|
}
|
|
772
766
|
}
|
|
767
|
+
static async _approveRun(client, workspace, project, pipelineId, runId, action, forceFetch) {
|
|
768
|
+
await client.pipelineRunApply(workspace, project, pipelineId, runId, {
|
|
769
|
+
operation: 'APPLY',
|
|
770
|
+
approve_action_id: action.id,
|
|
771
|
+
});
|
|
772
|
+
if (forceFetch)
|
|
773
|
+
setTimeout(forceFetch, 100);
|
|
774
|
+
}
|
|
773
775
|
static async _retryRun(client, workspace, project, pipelineId, runId, forceFetch) {
|
|
774
776
|
try {
|
|
775
777
|
await client.pipelineRunRetry(workspace, project, pipelineId, runId);
|
|
@@ -857,7 +859,9 @@ class OutputPipeline {
|
|
|
857
859
|
else if (action &&
|
|
858
860
|
name.toLowerCase() === 'a' &&
|
|
859
861
|
this._canApprove(action.status)) {
|
|
860
|
-
|
|
862
|
+
this._approveRun(client, workspace, project, pipelineId, runId, action, forceFetchAction)
|
|
863
|
+
.then()
|
|
864
|
+
.catch((err) => output_1.default.exitError(err));
|
|
861
865
|
}
|
|
862
866
|
return false;
|
|
863
867
|
}, () => {
|
|
@@ -1012,7 +1016,23 @@ class OutputPipeline {
|
|
|
1012
1016
|
else if (run &&
|
|
1013
1017
|
name.toLowerCase() === 'a' &&
|
|
1014
1018
|
this._canApprove(run.status)) {
|
|
1015
|
-
|
|
1019
|
+
let a = null;
|
|
1020
|
+
if (mode === MODE.ACTION) {
|
|
1021
|
+
a = action;
|
|
1022
|
+
}
|
|
1023
|
+
else if (mode === MODE.RUN) {
|
|
1024
|
+
if (run.actions[opts.selectedActionIndex]) {
|
|
1025
|
+
a = run.actions[opts.selectedActionIndex];
|
|
1026
|
+
}
|
|
1027
|
+
if (!a || !this._canApprove(a.status)) {
|
|
1028
|
+
a = run.actions.find((a) => this._canApprove(a.status));
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
if (a && this._canApprove(a.status)) {
|
|
1032
|
+
this._approveRun(client, workspace, project, pipelineId, runId, a, mode === MODE.RUN ? forceFetchRun : forceActionFetch)
|
|
1033
|
+
.then()
|
|
1034
|
+
.catch((err) => output_1.default.exitError(err));
|
|
1035
|
+
}
|
|
1016
1036
|
}
|
|
1017
1037
|
return false;
|
|
1018
1038
|
}, () => {
|
|
@@ -1314,7 +1334,7 @@ class OutputPipeline {
|
|
|
1314
1334
|
const fetchRun = async () => {
|
|
1315
1335
|
return await client.getPipelineRun(workspace, project, pipelineId, runId);
|
|
1316
1336
|
};
|
|
1317
|
-
const id =
|
|
1337
|
+
const id = runId;
|
|
1318
1338
|
let url;
|
|
1319
1339
|
let status;
|
|
1320
1340
|
let started;
|