bdy 1.22.23-dev → 1.22.23-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/api/client.js +110 -2
- package/distTs/src/command/pipeline/create.js +51 -0
- package/distTs/src/command/pipeline/delete.js +41 -0
- package/distTs/src/command/pipeline/get.js +51 -0
- package/distTs/src/command/pipeline/list.js +47 -0
- package/distTs/src/command/pipeline/run/apply.js +62 -0
- package/distTs/src/command/pipeline/run/approve.js +64 -0
- package/distTs/src/command/pipeline/run/cancel.js +38 -0
- package/distTs/src/command/pipeline/run/list.js +58 -0
- package/distTs/src/command/pipeline/run/logs.js +38 -0
- package/distTs/src/command/pipeline/run/retry.js +38 -0
- package/distTs/src/command/pipeline/run/start.js +98 -0
- package/distTs/src/command/pipeline/run/status.js +37 -0
- package/distTs/src/command/pipeline/run.js +22 -125
- package/distTs/src/command/pipeline/update.js +47 -0
- package/distTs/src/command/pipeline/yaml.js +38 -0
- package/distTs/src/command/pipeline.js +26 -0
- package/distTs/src/command/pre.js +1 -1
- package/distTs/src/command/project/link.js +11 -11
- package/distTs/src/input.js +11 -10
- package/distTs/src/output/pipeline.js +1677 -0
- package/distTs/src/output.js +156 -32
- package/distTs/src/texts.js +203 -169
- package/distTs/src/tunnel/output/interactive/tunnel.js +2 -2
- package/distTs/src/types/pipeline.js +424 -0
- package/package.json +1 -1
- package/distTs/src/command/project/get.js +0 -18
- package/distTs/src/command/project/set.js +0 -31
- package/distTs/src/command/sandbox/get/yaml.js +0 -30
- package/distTs/src/command/vt/scrape.js +0 -193
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const texts_1 = require("../../../texts");
|
|
8
|
+
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
+
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
+
const commandPipelineRunStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_PIPELINE_RUN_START);
|
|
11
|
+
commandPipelineRunStart.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
+
commandPipelineRunStart.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandPipelineRunStart.option('-b, --branch <branch>', texts_1.OPTION_PIPELINE_RUN_BRANCH);
|
|
14
|
+
commandPipelineRunStart.option('-t, --tag <tag>', texts_1.OPTION_PIPELINE_RUN_TAG);
|
|
15
|
+
commandPipelineRunStart.option('-pr, --pull-request <pull request>', texts_1.OPTION_PIPELINE_RUN_PULL_REQUEST);
|
|
16
|
+
commandPipelineRunStart.option('-r, --revision <revision>', texts_1.OPTION_PIPELINE_RUN_REVISION);
|
|
17
|
+
commandPipelineRunStart.option('--comment <comment>', texts_1.OPTION_PIPELINE_RUN_COMMENT);
|
|
18
|
+
commandPipelineRunStart.option('-f, --refresh', texts_1.OPTION_PIPELINE_RUN_REFRESH);
|
|
19
|
+
commandPipelineRunStart.option('-c, --clear-cache', texts_1.OPTION_PIPELINE_RUN_CLEAR_CACHE);
|
|
20
|
+
commandPipelineRunStart.option('--priority <priority>', texts_1.OPTION_PIPELINE_RUN_PRIORITY);
|
|
21
|
+
commandPipelineRunStart.option('-v, --variable <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
22
|
+
commandPipelineRunStart.option('-vm, --variable-masked <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
23
|
+
commandPipelineRunStart.option('--schedule <date>', texts_1.OPTION_PIPELINE_RUN_DELAY);
|
|
24
|
+
commandPipelineRunStart.option('--action <actions...>', texts_1.OPTION_PIPELINE_RUN_ACTION);
|
|
25
|
+
commandPipelineRunStart.option('-n,--no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
26
|
+
commandPipelineRunStart.option('--no-follow', texts_1.OPTION_PIPELINE_RUN_NO_FOLLOW);
|
|
27
|
+
commandPipelineRunStart.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
28
|
+
commandPipelineRunStart.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
29
|
+
commandPipelineRunStart.usage('<identifier> [options]');
|
|
30
|
+
commandPipelineRunStart.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_START}`);
|
|
31
|
+
commandPipelineRunStart.action(async (identifier, options) => {
|
|
32
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
33
|
+
const project = input_1.default.restApiProject(options.project);
|
|
34
|
+
const client = input_1.default.restApiTokenClient();
|
|
35
|
+
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
36
|
+
if (!data || !data.domain) {
|
|
37
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
38
|
+
}
|
|
39
|
+
if (!data.project_identifier) {
|
|
40
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
41
|
+
}
|
|
42
|
+
if (!data.pipeline_id) {
|
|
43
|
+
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
44
|
+
}
|
|
45
|
+
const body = {};
|
|
46
|
+
if (options.branch) {
|
|
47
|
+
body.branch = {
|
|
48
|
+
name: options.branch,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (options.tag) {
|
|
52
|
+
body.tag = {
|
|
53
|
+
name: options.tag,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (options.pullRequest) {
|
|
57
|
+
body.pull_request = {
|
|
58
|
+
name: `pull/${options.pullRequest}`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (options.revision) {
|
|
62
|
+
body.to_revision = {
|
|
63
|
+
revision: options.revision,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (options.comment) {
|
|
67
|
+
body.comment = options.comment;
|
|
68
|
+
}
|
|
69
|
+
if (options.refresh) {
|
|
70
|
+
body.refresh = true;
|
|
71
|
+
}
|
|
72
|
+
if (options.clearCache) {
|
|
73
|
+
body.clear_cache = true;
|
|
74
|
+
}
|
|
75
|
+
const priority = input_1.default.pipelineRunPriority(options.priority);
|
|
76
|
+
if (priority) {
|
|
77
|
+
body.priority = priority;
|
|
78
|
+
}
|
|
79
|
+
body.variables = [];
|
|
80
|
+
if (options.variable) {
|
|
81
|
+
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variable, false));
|
|
82
|
+
}
|
|
83
|
+
if (options.variableMasked) {
|
|
84
|
+
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variableMasked, true));
|
|
85
|
+
}
|
|
86
|
+
const delay = input_1.default.pipelineRunDelay(options.schedule);
|
|
87
|
+
if (delay) {
|
|
88
|
+
body.delay_until = delay;
|
|
89
|
+
}
|
|
90
|
+
const actions = input_1.default.pipelineRunAction(options.action);
|
|
91
|
+
if (actions) {
|
|
92
|
+
body.actions_to_run = actions;
|
|
93
|
+
}
|
|
94
|
+
const result = await client.pipelineRun(workspace, project, data.pipeline_id, body);
|
|
95
|
+
const OutputPipeline = require('../../../output/pipeline').default;
|
|
96
|
+
await OutputPipeline.runStatus(client, workspace, project, identifier, data.pipeline_id, result.id, !options.wait, !options.follow, options.format === 'json');
|
|
97
|
+
});
|
|
98
|
+
exports.default = commandPipelineRunStart;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const texts_1 = require("../../../texts");
|
|
8
|
+
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
+
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
+
const commandPipelineRunStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_PIPELINE_RUN_STATUS);
|
|
11
|
+
commandPipelineRunStatus.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
+
commandPipelineRunStatus.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandPipelineRunStatus.option('-n, --no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
14
|
+
commandPipelineRunStatus.option('--no-follow', texts_1.OPTION_PIPELINE_RUN_NO_FOLLOW);
|
|
15
|
+
commandPipelineRunStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
16
|
+
commandPipelineRunStatus.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
17
|
+
commandPipelineRunStatus.argument('<run-id>', texts_1.OPTION_PIPELINE_RUN_ID);
|
|
18
|
+
commandPipelineRunStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_STATUS}`);
|
|
19
|
+
commandPipelineRunStatus.action(async (identifier, runId, options) => {
|
|
20
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
|
+
const project = input_1.default.restApiProject(options.project);
|
|
22
|
+
const client = input_1.default.restApiTokenClient();
|
|
23
|
+
const rid = input_1.default.pipelineRunId(runId);
|
|
24
|
+
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
25
|
+
if (!data || !data.domain) {
|
|
26
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
27
|
+
}
|
|
28
|
+
if (!data.project_identifier) {
|
|
29
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
30
|
+
}
|
|
31
|
+
if (!data.pipeline_id) {
|
|
32
|
+
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
33
|
+
}
|
|
34
|
+
const OutputPipeline = require('../../../output/pipeline').default;
|
|
35
|
+
await OutputPipeline.runStatus(client, workspace, project, identifier, data.pipeline_id, rid, !options.wait, !options.follow, options.format === 'json');
|
|
36
|
+
});
|
|
37
|
+
exports.default = commandPipelineRunStatus;
|
|
@@ -5,130 +5,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const status_1 = __importDefault(require("./run/status"));
|
|
9
|
+
const start_1 = __importDefault(require("./run/start"));
|
|
10
|
+
const logs_1 = __importDefault(require("./run/logs"));
|
|
11
|
+
const cancel_1 = __importDefault(require("./run/cancel"));
|
|
12
|
+
const retry_1 = __importDefault(require("./run/retry"));
|
|
13
|
+
const list_1 = __importDefault(require("./run/list"));
|
|
14
|
+
const approve_1 = __importDefault(require("./run/approve"));
|
|
11
15
|
const commandPipelineRun = (0, utils_1.newCommand)('run', texts_1.DESC_COMMAND_PIPELINE_RUN);
|
|
12
|
-
commandPipelineRun.
|
|
13
|
-
commandPipelineRun.
|
|
14
|
-
commandPipelineRun.
|
|
15
|
-
commandPipelineRun.
|
|
16
|
-
commandPipelineRun.
|
|
17
|
-
commandPipelineRun.
|
|
18
|
-
commandPipelineRun.
|
|
19
|
-
commandPipelineRun.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
commandPipelineRun.argument('<identifier>', texts_1.OPTION_PIPELINE_RUN_ARGUMENT);
|
|
28
|
-
commandPipelineRun.usage('<identifier> [options]');
|
|
29
|
-
commandPipelineRun.addHelpText('after', texts_1.EXAMPLE_PIPELINE_RUN);
|
|
30
|
-
commandPipelineRun.action(async (identifier, options) => {
|
|
31
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
32
|
-
const project = input_1.default.restApiProject(options.project);
|
|
33
|
-
const client = input_1.default.restApiTokenClient();
|
|
34
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
35
|
-
if (!data || !data.domain) {
|
|
36
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
37
|
-
}
|
|
38
|
-
if (!data.project_identifier) {
|
|
39
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
40
|
-
}
|
|
41
|
-
if (!data.pipeline_id) {
|
|
42
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
43
|
-
}
|
|
44
|
-
const body = {};
|
|
45
|
-
if (options.branch) {
|
|
46
|
-
body.branch = {
|
|
47
|
-
name: options.branch,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (options.tag) {
|
|
51
|
-
body.tag = {
|
|
52
|
-
name: options.tag,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
if (options.pullRequest) {
|
|
56
|
-
body.pull_request = {
|
|
57
|
-
name: `pull/${options.pullRequest}`,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if (options.revision) {
|
|
61
|
-
body.to_revision = {
|
|
62
|
-
revision: options.revision,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
if (options.comment) {
|
|
66
|
-
body.comment = options.comment;
|
|
67
|
-
}
|
|
68
|
-
if (options.refresh) {
|
|
69
|
-
body.refresh = true;
|
|
70
|
-
}
|
|
71
|
-
if (options.clearCache) {
|
|
72
|
-
body.clear_cache = true;
|
|
73
|
-
}
|
|
74
|
-
const priority = input_1.default.pipelineRunPriority(options.priority);
|
|
75
|
-
if (priority) {
|
|
76
|
-
body.priority = priority;
|
|
77
|
-
}
|
|
78
|
-
body.variables = [];
|
|
79
|
-
if (options.variable) {
|
|
80
|
-
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variable, false));
|
|
81
|
-
}
|
|
82
|
-
if (options.variableMasked) {
|
|
83
|
-
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variableMasked, true));
|
|
84
|
-
}
|
|
85
|
-
const delay = input_1.default.pipelineRunDelay(options.schedule);
|
|
86
|
-
if (delay) {
|
|
87
|
-
body.delay_until = delay;
|
|
88
|
-
}
|
|
89
|
-
const actions = input_1.default.pipelineRunAction(options.action);
|
|
90
|
-
if (actions) {
|
|
91
|
-
body.actions_to_run = actions;
|
|
92
|
-
}
|
|
93
|
-
const result = await client.pipelineRun(workspace, project, data.pipeline_id, body);
|
|
94
|
-
if (options.wait) {
|
|
95
|
-
const minutes = input_1.default.pipelineRunWaitTime(options.wait);
|
|
96
|
-
wait(minutes, workspace, project, data.pipeline_id, result.id, result.html_url, client);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
output_1.default.exitSuccess((0, texts_1.TXT_PIPELINE_RUN_SUCCESS)(result.html_url));
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const wait = (minutes, workspace, project, pipelineId, runId, htmlUrl, client) => {
|
|
103
|
-
const start = Date.now();
|
|
104
|
-
output_1.default.normal((0, texts_1.TXT_PIPELINE_RUN_WAIT)(minutes));
|
|
105
|
-
let fetchCounter = 1;
|
|
106
|
-
const ts1 = setTimeout(() => {
|
|
107
|
-
output_1.default.exitError(texts_1.ERR_RUN_PIPELINE_WAIT_TIMEOUT);
|
|
108
|
-
}, minutes * 60 * 1000);
|
|
109
|
-
const ts2 = setInterval(async () => {
|
|
110
|
-
output_1.default.clearPreviousLine();
|
|
111
|
-
output_1.default.normal((0, texts_1.TXT_PIPELINE_RUN_STILL_WAITING)(formatWaitTime(start)));
|
|
112
|
-
if (fetchCounter >= 3) {
|
|
113
|
-
const run = await client.getPipelineRun(workspace, project, pipelineId, runId);
|
|
114
|
-
if (!['INPROGRESS', 'ENQUEUED', 'TERMINATING'].includes(run.status)) {
|
|
115
|
-
clearTimeout(ts1);
|
|
116
|
-
clearInterval(ts2);
|
|
117
|
-
output_1.default.clearPreviousLine();
|
|
118
|
-
if (run.status === 'SUCCESSFUL') {
|
|
119
|
-
output_1.default.exitSuccess((0, texts_1.TXT_PIPELINE_RUN_FINISH_SUCCESSFULLY)(htmlUrl));
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
output_1.default.exitError((0, texts_1.TXT_PIPELINE_RUN_FINISH_FAILED)(run.status, htmlUrl));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
fetchCounter = 0;
|
|
126
|
-
}
|
|
127
|
-
fetchCounter += 1;
|
|
128
|
-
}, 1000);
|
|
129
|
-
};
|
|
130
|
-
const formatWaitTime = (start) => {
|
|
131
|
-
const elapsed = Math.floor((Date.now() - start) / 1000);
|
|
132
|
-
return format_1.default.pipelineRunWaitTime(elapsed);
|
|
133
|
-
};
|
|
16
|
+
commandPipelineRun.addCommand(start_1.default);
|
|
17
|
+
commandPipelineRun.addCommand(status_1.default);
|
|
18
|
+
commandPipelineRun.addCommand(logs_1.default);
|
|
19
|
+
commandPipelineRun.addCommand(cancel_1.default);
|
|
20
|
+
commandPipelineRun.addCommand(retry_1.default);
|
|
21
|
+
commandPipelineRun.addCommand(approve_1.default);
|
|
22
|
+
commandPipelineRun.addCommand(list_1.default);
|
|
23
|
+
commandPipelineRun.addHelpText('after', `
|
|
24
|
+
EXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_START}
|
|
25
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_STATUS}
|
|
26
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_LOGS}
|
|
27
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_CANCEL}
|
|
28
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_RETRY}
|
|
29
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_APPLY}
|
|
30
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_LIST}`);
|
|
134
31
|
exports.default = commandPipelineRun;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const input_1 = __importDefault(require("../../input"));
|
|
9
|
+
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const commandPipelineUpdate = (0, utils_1.newCommand)('update', texts_1.DESC_COMMAND_PIPELINE_UPDATE);
|
|
11
|
+
commandPipelineUpdate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
+
commandPipelineUpdate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
+
commandPipelineUpdate.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
14
|
+
commandPipelineUpdate.argument('<yaml|@path>', texts_1.OPTION_PIPELINE_YAML);
|
|
15
|
+
commandPipelineUpdate.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
16
|
+
commandPipelineUpdate.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_UPDATE}`);
|
|
17
|
+
commandPipelineUpdate.action(async (identifier, y, options) => {
|
|
18
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
+
const project = input_1.default.restApiProject(options.project);
|
|
20
|
+
const yaml = input_1.default.restApiYaml(y);
|
|
21
|
+
const client = input_1.default.restApiTokenClient();
|
|
22
|
+
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
23
|
+
if (!data || !data.domain) {
|
|
24
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
25
|
+
}
|
|
26
|
+
if (!data.project_identifier) {
|
|
27
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
28
|
+
}
|
|
29
|
+
if (!data.pipeline_id) {
|
|
30
|
+
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
31
|
+
}
|
|
32
|
+
await client.updatePipelineYml(workspace, project, data.pipeline_id, {
|
|
33
|
+
yaml: Buffer.from(yaml, 'utf8').toString('base64'),
|
|
34
|
+
});
|
|
35
|
+
const result = await client.getPipeline(workspace, project, data.pipeline_id);
|
|
36
|
+
if (options.format === 'json') {
|
|
37
|
+
output_1.default.json(result);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
output_1.default.dim('Identifier: ', false);
|
|
41
|
+
output_1.default.cyan(result.identifier);
|
|
42
|
+
output_1.default.cyan(result.html_url);
|
|
43
|
+
output_1.default.green(texts_1.TXT_PIPELINE_UPDATED);
|
|
44
|
+
}
|
|
45
|
+
output_1.default.exitNormal();
|
|
46
|
+
});
|
|
47
|
+
exports.default = commandPipelineUpdate;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const input_1 = __importDefault(require("../../input"));
|
|
9
|
+
const output_1 = __importDefault(require("../../output"));
|
|
10
|
+
const commandPipelineYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_PIPELINE_YAML);
|
|
11
|
+
commandPipelineYaml.hideVersionUpdate = true;
|
|
12
|
+
commandPipelineYaml.alias('yml');
|
|
13
|
+
commandPipelineYaml.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
|
+
commandPipelineYaml.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
15
|
+
commandPipelineYaml.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
16
|
+
commandPipelineYaml.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_YML}`);
|
|
17
|
+
commandPipelineYaml.action(async (identifier, options) => {
|
|
18
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
+
const project = input_1.default.restApiProject(options.project);
|
|
20
|
+
const client = input_1.default.restApiTokenClient();
|
|
21
|
+
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
22
|
+
if (!data || !data.domain) {
|
|
23
|
+
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
24
|
+
}
|
|
25
|
+
if (!data.project_identifier) {
|
|
26
|
+
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
27
|
+
}
|
|
28
|
+
if (!data.pipeline_id) {
|
|
29
|
+
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
30
|
+
}
|
|
31
|
+
const result = await client.getPipelineYml(workspace, project, data.pipeline_id);
|
|
32
|
+
let yml = '';
|
|
33
|
+
if (result.yaml) {
|
|
34
|
+
yml = Buffer.from(result.yaml, 'base64').toString('utf8');
|
|
35
|
+
}
|
|
36
|
+
output_1.default.exitNormal(yml);
|
|
37
|
+
});
|
|
38
|
+
exports.default = commandPipelineYaml;
|
|
@@ -6,7 +6,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const texts_1 = require("../texts");
|
|
8
8
|
const run_1 = __importDefault(require("./pipeline/run"));
|
|
9
|
+
const list_1 = __importDefault(require("./pipeline/list"));
|
|
10
|
+
const get_1 = __importDefault(require("./pipeline/get"));
|
|
11
|
+
const yaml_1 = __importDefault(require("./pipeline/yaml"));
|
|
12
|
+
const create_1 = __importDefault(require("./pipeline/create"));
|
|
13
|
+
const update_1 = __importDefault(require("./pipeline/update"));
|
|
14
|
+
const delete_1 = __importDefault(require("./pipeline/delete"));
|
|
9
15
|
const commandPipeline = (0, utils_1.newCommand)('pipeline', texts_1.DESC_COMMAND_PIPELINE);
|
|
10
16
|
commandPipeline.alias('pip');
|
|
11
17
|
commandPipeline.addCommand(run_1.default);
|
|
18
|
+
commandPipeline.addCommand(list_1.default);
|
|
19
|
+
commandPipeline.addCommand(get_1.default);
|
|
20
|
+
commandPipeline.addCommand(delete_1.default);
|
|
21
|
+
commandPipeline.addCommand(yaml_1.default);
|
|
22
|
+
commandPipeline.addCommand(create_1.default);
|
|
23
|
+
commandPipeline.addCommand(update_1.default);
|
|
24
|
+
commandPipeline.addHelpText('after', `
|
|
25
|
+
EXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_START}
|
|
26
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_STATUS}
|
|
27
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_LOGS}
|
|
28
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_CANCEL}
|
|
29
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_RETRY}
|
|
30
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_APPLY}
|
|
31
|
+
${texts_1.EXAMPLE_PIPELINE_RUN_LIST}
|
|
32
|
+
${texts_1.EXAMPLE_PIPELINE_LIST}
|
|
33
|
+
${texts_1.EXAMPLE_PIPELINE_GET}
|
|
34
|
+
${texts_1.EXAMPLE_PIPELINE_DELETE}
|
|
35
|
+
${texts_1.EXAMPLE_PIPELINE_YML}
|
|
36
|
+
${texts_1.EXAMPLE_PIPELINE_CREATE}
|
|
37
|
+
${texts_1.EXAMPLE_PIPELINE_UPDATE}`);
|
|
12
38
|
exports.default = commandPipeline;
|
|
@@ -39,7 +39,7 @@ const commandPre = async (_, command) => {
|
|
|
39
39
|
// do nothing
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (command.hideVersionUpdate) {
|
|
42
|
+
if (command.hideVersionUpdate || command.opts()?.format === 'json') {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
const newCli = !!command.latestVersion && command.currentVersion !== command.latestVersion;
|
|
@@ -23,7 +23,7 @@ commandProjectLink.action(async (dir, options) => {
|
|
|
23
23
|
ProjectCfg.init(path, workspace, project);
|
|
24
24
|
output_1.default.okSign();
|
|
25
25
|
output_1.default.normal(texts_1.TXT_COMMAND_PROJECT_LINK_TO, false);
|
|
26
|
-
output_1.default.
|
|
26
|
+
output_1.default.cyan(` ${url}`);
|
|
27
27
|
await initRepo(workspace, project, path, git, options);
|
|
28
28
|
tryNow();
|
|
29
29
|
output_1.default.exitNormal();
|
|
@@ -54,13 +54,13 @@ const tryNow = () => {
|
|
|
54
54
|
output_1.default.arrowSign();
|
|
55
55
|
output_1.default.label(texts_1.OPT_COMMAND_PROJECT_LINK_TRY_NOW);
|
|
56
56
|
output_1.default.dim('$ ', false);
|
|
57
|
-
output_1.default.
|
|
57
|
+
output_1.default.cyan('bdy tunnel http 3000 ', false);
|
|
58
58
|
output_1.default.muted(' Expose localhost:3000 to the internet');
|
|
59
59
|
output_1.default.dim('$ ', false);
|
|
60
|
-
output_1.default.
|
|
60
|
+
output_1.default.cyan('bdy artifact publish . ', false);
|
|
61
61
|
output_1.default.muted(' Publish an artifact from the current project');
|
|
62
62
|
output_1.default.dim('$ ', false);
|
|
63
|
-
output_1.default.
|
|
63
|
+
output_1.default.cyan('bdy sandbox create --run "npm start" ', false);
|
|
64
64
|
output_1.default.muted(' Spin up a cloud sandbox and run your app');
|
|
65
65
|
};
|
|
66
66
|
const initRepo = async (workspace, project, path, git, options) => {
|
|
@@ -89,16 +89,16 @@ const initRepo = async (workspace, project, path, git, options) => {
|
|
|
89
89
|
});
|
|
90
90
|
output_1.default.okSign();
|
|
91
91
|
output_1.default.normal('Remote ', false);
|
|
92
|
-
output_1.default.
|
|
92
|
+
output_1.default.cyan('origin ', false);
|
|
93
93
|
output_1.default.normal('set to ', false);
|
|
94
|
-
output_1.default.
|
|
94
|
+
output_1.default.cyan(remote);
|
|
95
95
|
}
|
|
96
96
|
else if (remotes.origin !== remote) {
|
|
97
97
|
output_1.default.yellow(texts_1.OPT_COMMAND_PROJECT_LINK_HAS_REMOTE);
|
|
98
98
|
output_1.default.normal('Current origin: ', false);
|
|
99
|
-
output_1.default.
|
|
99
|
+
output_1.default.cyan(remotes.origin);
|
|
100
100
|
output_1.default.normal('Buddy project: ', false);
|
|
101
|
-
output_1.default.
|
|
101
|
+
output_1.default.cyan(remote);
|
|
102
102
|
const opt = await output_1.default.inputMenuAdv(texts_1.OPT_COMMAND_PROJECT_LINK_SET_GIT_REMOTE, [
|
|
103
103
|
{
|
|
104
104
|
name: 'Add buddy remote',
|
|
@@ -127,9 +127,9 @@ const initRepo = async (workspace, project, path, git, options) => {
|
|
|
127
127
|
});
|
|
128
128
|
output_1.default.okSign();
|
|
129
129
|
output_1.default.normal('Remote ', false);
|
|
130
|
-
output_1.default.
|
|
130
|
+
output_1.default.cyan('buddy ', false);
|
|
131
131
|
output_1.default.normal('set to ', false);
|
|
132
|
-
output_1.default.
|
|
132
|
+
output_1.default.cyan(remote);
|
|
133
133
|
}
|
|
134
134
|
else if (opt === 'origin') {
|
|
135
135
|
await (0, utils_1.execLocally)(`git remote rm origin`, {
|
|
@@ -140,7 +140,7 @@ const initRepo = async (workspace, project, path, git, options) => {
|
|
|
140
140
|
});
|
|
141
141
|
output_1.default.okSign();
|
|
142
142
|
output_1.default.normal('Origin replaced with ', false);
|
|
143
|
-
output_1.default.
|
|
143
|
+
output_1.default.cyan(remote);
|
|
144
144
|
}
|
|
145
145
|
else {
|
|
146
146
|
return;
|
package/distTs/src/input.js
CHANGED
|
@@ -351,6 +351,17 @@ class Input {
|
|
|
351
351
|
return utils_1.ARTIFACT_SCOPE.PROJECT;
|
|
352
352
|
return utils_1.ARTIFACT_SCOPE.WORKSPACE;
|
|
353
353
|
}
|
|
354
|
+
static pipelineRunId(runId) {
|
|
355
|
+
const r = parseInt(runId, 10);
|
|
356
|
+
if (!isNaN(r))
|
|
357
|
+
return r;
|
|
358
|
+
output_1.default.exitError(texts_1.ERR_RUN_PIPELINE_WRONG_RUN_ID);
|
|
359
|
+
}
|
|
360
|
+
static pipelineRunActionId(runActionId) {
|
|
361
|
+
if (runActionId)
|
|
362
|
+
return runActionId;
|
|
363
|
+
output_1.default.exitError(texts_1.ERR_RUN_PIPELINE_WRONG_RUN_ACTION_ID);
|
|
364
|
+
}
|
|
354
365
|
static pipelineRunPriority(priority) {
|
|
355
366
|
if (!priority)
|
|
356
367
|
return null;
|
|
@@ -491,16 +502,6 @@ class Input {
|
|
|
491
502
|
output_1.default.exitError(texts_1.ERR_REST_API_URL);
|
|
492
503
|
}
|
|
493
504
|
}
|
|
494
|
-
static pipelineRunWaitTime(time) {
|
|
495
|
-
let t = Number.parseInt(time, 10);
|
|
496
|
-
if (!t)
|
|
497
|
-
t = 1440;
|
|
498
|
-
else if (t < 0)
|
|
499
|
-
t = 1;
|
|
500
|
-
else if (t > 1440)
|
|
501
|
-
t = 1440;
|
|
502
|
-
return t;
|
|
503
|
-
}
|
|
504
505
|
static resolvePath(path) {
|
|
505
506
|
const p = (0, node_path_1.resolve)(path);
|
|
506
507
|
const exists = node_fs_1.default.existsSync(p);
|