bdy 1.22.25-dev-pipeline → 1.22.25
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 +2 -110
- package/distTs/src/command/pipeline/run/start.js +14 -6
- package/distTs/src/command/pipeline/run.js +125 -22
- package/distTs/src/command/pipeline.js +0 -26
- package/distTs/src/command/pre.js +1 -1
- package/distTs/src/command/project/get.js +18 -0
- package/distTs/src/command/project/link.js +11 -11
- package/distTs/src/command/project/set.js +31 -0
- package/distTs/src/command/sandbox/get/yaml.js +30 -0
- package/distTs/src/command/vt/scrape.js +193 -0
- package/distTs/src/input.js +15 -61
- package/distTs/src/output/pipeline.js +14 -7
- package/distTs/src/output.js +32 -156
- package/distTs/src/texts.js +169 -217
- package/distTs/src/tunnel/output/interactive/tunnel.js +2 -2
- package/distTs/src/tunnel/server/sftp.js +38 -9
- package/distTs/src/tunnel/tunnel.js +0 -24
- package/package.json +1 -1
- package/distTs/src/command/pipeline/run/apply.js +0 -62
package/distTs/package.json
CHANGED
package/distTs/src/api/client.js
CHANGED
|
@@ -216,79 +216,6 @@ class ApiClient {
|
|
|
216
216
|
throw new Error(texts_1.ERR_REST_API_GENERAL_ERROR);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
async getPipelineRunActionLogs(workspace, project, pipelineId, executionId, actionExecutionId, offset, limit) {
|
|
220
|
-
const query = {
|
|
221
|
-
offset: String(offset),
|
|
222
|
-
limit: String(limit),
|
|
223
|
-
};
|
|
224
|
-
return await this.request({
|
|
225
|
-
method: 'GET',
|
|
226
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/executions/${encodeURIComponent(executionId)}/action_executions/${encodeURIComponent(actionExecutionId)}/logs`,
|
|
227
|
-
query,
|
|
228
|
-
parseResponseBody: true,
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
async getPipelineRunActionExecution(workspace, project, pipelineId, executionId, actionExecutionId) {
|
|
232
|
-
return await this.request({
|
|
233
|
-
method: 'GET',
|
|
234
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/executions/${encodeURIComponent(executionId)}/action_executions/${encodeURIComponent(actionExecutionId)}`,
|
|
235
|
-
parseResponseBody: true,
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
async updatePipelineYml(workspace, project, pipelineId, body) {
|
|
239
|
-
return await this.request({
|
|
240
|
-
method: 'PATCH',
|
|
241
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/yaml`,
|
|
242
|
-
body,
|
|
243
|
-
parseResponseBody: true
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
async createPipeline(workspace, project, body) {
|
|
247
|
-
return await this.request({
|
|
248
|
-
method: 'POST',
|
|
249
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines`,
|
|
250
|
-
body,
|
|
251
|
-
parseResponseBody: true
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
async getPipelines(workspace, project, page = 1, perPage = 10) {
|
|
255
|
-
const query = {
|
|
256
|
-
page: String(page),
|
|
257
|
-
per_page: String(perPage),
|
|
258
|
-
};
|
|
259
|
-
return await this.request({
|
|
260
|
-
method: 'GET',
|
|
261
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines`,
|
|
262
|
-
query,
|
|
263
|
-
parseResponseBody: true,
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
async getPipelineYml(workspace, project, pipelineId) {
|
|
267
|
-
return await this.request({
|
|
268
|
-
method: 'GET',
|
|
269
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/yaml`,
|
|
270
|
-
parseResponseBody: true,
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
async getPipeline(workspace, project, pipelineId) {
|
|
274
|
-
return await this.request({
|
|
275
|
-
method: 'GET',
|
|
276
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}`,
|
|
277
|
-
parseResponseBody: true,
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
async getPipelineRuns(workspace, project, pipelineId, page = 1, perPage = 10) {
|
|
281
|
-
const query = {
|
|
282
|
-
page: String(page),
|
|
283
|
-
per_page: String(perPage),
|
|
284
|
-
};
|
|
285
|
-
return await this.request({
|
|
286
|
-
method: 'GET',
|
|
287
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/executions`,
|
|
288
|
-
query,
|
|
289
|
-
parseResponseBody: true,
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
219
|
async getPipelineRun(workspace, project, pipelineId, executionId) {
|
|
293
220
|
return await this.request({
|
|
294
221
|
method: 'GET',
|
|
@@ -395,34 +322,6 @@ class ApiClient {
|
|
|
395
322
|
parseResponseBody: true,
|
|
396
323
|
});
|
|
397
324
|
}
|
|
398
|
-
async pipelineRunRetry(workspace, project, pipelineId, runId) {
|
|
399
|
-
return await this.request({
|
|
400
|
-
method: 'PATCH',
|
|
401
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/executions/${encodeURIComponent(runId)}`,
|
|
402
|
-
body: {
|
|
403
|
-
operation: 'RETRY',
|
|
404
|
-
},
|
|
405
|
-
parseResponseBody: true,
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
async pipelineRunApply(workspace, project, pipelineId, runId, body) {
|
|
409
|
-
return await this.request({
|
|
410
|
-
method: 'PATCH',
|
|
411
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/executions/${encodeURIComponent(runId)}`,
|
|
412
|
-
body,
|
|
413
|
-
parseResponseBody: true,
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
async pipelineRunCancel(workspace, project, pipelineId, runId) {
|
|
417
|
-
return await this.request({
|
|
418
|
-
method: 'PATCH',
|
|
419
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}/executions/${encodeURIComponent(runId)}`,
|
|
420
|
-
body: {
|
|
421
|
-
operation: 'CANCEL',
|
|
422
|
-
},
|
|
423
|
-
parseResponseBody: true,
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
325
|
async pipelineRun(workspace, project, pipelineId, body) {
|
|
427
326
|
return await this.request({
|
|
428
327
|
method: 'POST',
|
|
@@ -431,13 +330,6 @@ class ApiClient {
|
|
|
431
330
|
parseResponseBody: true,
|
|
432
331
|
});
|
|
433
332
|
}
|
|
434
|
-
async deletePipeline(workspace, project, pipelineId) {
|
|
435
|
-
return await this.request({
|
|
436
|
-
method: 'DELETE',
|
|
437
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/projects/${encodeURIComponent(project)}/pipelines/${encodeURIComponent(pipelineId)}`,
|
|
438
|
-
parseResponseBody: false,
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
333
|
// Sandbox methods
|
|
442
334
|
async createSandbox(workspace, project, body) {
|
|
443
335
|
return await this.request({
|
|
@@ -912,14 +804,14 @@ class ApiClient {
|
|
|
912
804
|
return await this.request({
|
|
913
805
|
method: 'POST',
|
|
914
806
|
path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/apps/${encodeURIComponent(appId)}/stop`,
|
|
915
|
-
parseResponseBody: true
|
|
807
|
+
parseResponseBody: true
|
|
916
808
|
});
|
|
917
809
|
}
|
|
918
810
|
async startSandboxApp(workspace, sandboxId, appId) {
|
|
919
811
|
return await this.request({
|
|
920
812
|
method: 'POST',
|
|
921
813
|
path: `/workspaces/${encodeURIComponent(workspace)}/sandboxes/${encodeURIComponent(sandboxId)}/apps/${encodeURIComponent(appId)}/start`,
|
|
922
|
-
parseResponseBody: true
|
|
814
|
+
parseResponseBody: true
|
|
923
815
|
});
|
|
924
816
|
}
|
|
925
817
|
async getSandboxAppLogs(workspace, sandboxId, appId, cursor) {
|
|
@@ -20,8 +20,10 @@ commandPipelineRunStart.option('-c, --clear-cache', texts_1.OPTION_PIPELINE_RUN_
|
|
|
20
20
|
commandPipelineRunStart.option('--priority <priority>', texts_1.OPTION_PIPELINE_RUN_PRIORITY);
|
|
21
21
|
commandPipelineRunStart.option('-v, --variable <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
22
22
|
commandPipelineRunStart.option('-vf, --variables-from-file <filepath>', texts_1.OPTION_PIPELINE_RUN_VAR_FILE);
|
|
23
|
+
commandPipelineRunStart.option('-vff, --variable-from-file <variables...>', texts_1.OPTION_PIPELINE_RUN_SINGLE_VAR_FILE);
|
|
23
24
|
commandPipelineRunStart.option('-vm, --variable-masked <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
24
25
|
commandPipelineRunStart.option('-vmf, --variables-masked-from-file <filepath>', texts_1.OPTION_PIPELINE_RUN_VAR_FILE);
|
|
26
|
+
commandPipelineRunStart.option('-vmff, --variable-masked-from-file <variables...>', texts_1.OPTION_PIPELINE_RUN_SINGLE_VAR_FILE);
|
|
25
27
|
commandPipelineRunStart.option('--schedule <date>', texts_1.OPTION_PIPELINE_RUN_DELAY);
|
|
26
28
|
commandPipelineRunStart.option('--action <actions...>', texts_1.OPTION_PIPELINE_RUN_ACTION);
|
|
27
29
|
commandPipelineRunStart.option('-n,--no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
@@ -80,18 +82,24 @@ commandPipelineRunStart.action(async (identifier, options) => {
|
|
|
80
82
|
body.priority = priority;
|
|
81
83
|
}
|
|
82
84
|
body.variables = [];
|
|
83
|
-
if (options.variable) {
|
|
84
|
-
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variable, false));
|
|
85
|
-
}
|
|
86
|
-
if (options.variableMasked) {
|
|
87
|
-
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variableMasked, true));
|
|
88
|
-
}
|
|
89
85
|
if (options.variablesFromFile) {
|
|
90
86
|
body.variables = body.variables.concat(input_1.default.pipelineRunVariablesFromFile(options.variablesFromFile, false));
|
|
91
87
|
}
|
|
92
88
|
if (options.variablesMaskedFromFile) {
|
|
93
89
|
body.variables = body.variables.concat(input_1.default.pipelineRunVariablesFromFile(options.variablesMaskedFromFile, true));
|
|
94
90
|
}
|
|
91
|
+
if (options.variableFromFile) {
|
|
92
|
+
body.variables = body.variables.concat(input_1.default.pipelineRunVariableFromFile(options.variableFromFile, false));
|
|
93
|
+
}
|
|
94
|
+
if (options.variableMaskedFromFile) {
|
|
95
|
+
body.variables = body.variables.concat(input_1.default.pipelineRunVariableFromFile(options.variableMaskedFromFile, true));
|
|
96
|
+
}
|
|
97
|
+
if (options.variable) {
|
|
98
|
+
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variable, false));
|
|
99
|
+
}
|
|
100
|
+
if (options.variableMasked) {
|
|
101
|
+
body.variables = body.variables.concat(input_1.default.pipelineRunVariable(options.variableMasked, true));
|
|
102
|
+
}
|
|
95
103
|
const delay = input_1.default.pipelineRunDelay(options.schedule);
|
|
96
104
|
if (delay) {
|
|
97
105
|
body.delay_until = delay;
|
|
@@ -5,27 +5,130 @@ 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
|
|
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"));
|
|
8
|
+
const output_1 = __importDefault(require("../../output"));
|
|
9
|
+
const input_1 = __importDefault(require("../../input"));
|
|
10
|
+
const format_1 = __importDefault(require("../../format"));
|
|
15
11
|
const commandPipelineRun = (0, utils_1.newCommand)('run', texts_1.DESC_COMMAND_PIPELINE_RUN);
|
|
16
|
-
commandPipelineRun.
|
|
17
|
-
commandPipelineRun.
|
|
18
|
-
commandPipelineRun.
|
|
19
|
-
commandPipelineRun.
|
|
20
|
-
commandPipelineRun.
|
|
21
|
-
commandPipelineRun.
|
|
22
|
-
commandPipelineRun.
|
|
23
|
-
commandPipelineRun.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
commandPipelineRun.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandPipelineRun.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
+
commandPipelineRun.option('-b, --branch <branch>', texts_1.OPTION_PIPELINE_RUN_BRANCH);
|
|
15
|
+
commandPipelineRun.option('-t, --tag <tag>', texts_1.OPTION_PIPELINE_RUN_TAG);
|
|
16
|
+
commandPipelineRun.option('-pr, --pull-request <pull request>', texts_1.OPTION_PIPELINE_RUN_PULL_REQUEST);
|
|
17
|
+
commandPipelineRun.option('-r, --revision <revision>', texts_1.OPTION_PIPELINE_RUN_REVISION);
|
|
18
|
+
commandPipelineRun.option('--comment <comment>', texts_1.OPTION_PIPELINE_RUN_COMMENT);
|
|
19
|
+
commandPipelineRun.option('-f, --refresh', texts_1.OPTION_PIPELINE_RUN_REFRESH);
|
|
20
|
+
commandPipelineRun.option('-c, --clear-cache', texts_1.OPTION_PIPELINE_RUN_CLEAR_CACHE);
|
|
21
|
+
commandPipelineRun.option('--priority <priority>', texts_1.OPTION_PIPELINE_RUN_PRIORITY);
|
|
22
|
+
commandPipelineRun.option('-v, --variable <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
23
|
+
commandPipelineRun.option('-vm, --variable-masked <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
24
|
+
commandPipelineRun.option('--schedule <date>', texts_1.OPTION_PIPELINE_RUN_DELAY);
|
|
25
|
+
commandPipelineRun.option('--action <actions...>', texts_1.OPTION_PIPELINE_RUN_ACTION);
|
|
26
|
+
commandPipelineRun.option('--wait [minutes]', texts_1.OPTION_PIPELINE_RUN_WAIT);
|
|
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
|
+
};
|
|
31
134
|
exports.default = commandPipelineRun;
|
|
@@ -6,33 +6,7 @@ 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"));
|
|
15
9
|
const commandPipeline = (0, utils_1.newCommand)('pipeline', texts_1.DESC_COMMAND_PIPELINE);
|
|
16
10
|
commandPipeline.alias('pip');
|
|
17
11
|
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}`);
|
|
38
12
|
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) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
const newCli = !!command.latestVersion && command.currentVersion !== command.latestVersion;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
7
|
+
const output_1 = __importDefault(require("../../output"));
|
|
8
|
+
const texts_1 = require("../../texts");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const commandProjectGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_PROJECT_GET);
|
|
11
|
+
commandProjectGet.action(async () => {
|
|
12
|
+
const project = cfg_1.default.getProject();
|
|
13
|
+
if (!project) {
|
|
14
|
+
output_1.default.exitError(texts_1.TXT_PROJECT_NONE);
|
|
15
|
+
}
|
|
16
|
+
output_1.default.exitNormal(project);
|
|
17
|
+
});
|
|
18
|
+
exports.default = commandProjectGet;
|
|
@@ -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.light(` ${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.light('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.light('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.light('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.light('origin ', false);
|
|
93
93
|
output_1.default.normal('set to ', false);
|
|
94
|
-
output_1.default.
|
|
94
|
+
output_1.default.light(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.light(remotes.origin);
|
|
100
100
|
output_1.default.normal('Buddy project: ', false);
|
|
101
|
-
output_1.default.
|
|
101
|
+
output_1.default.light(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.light('buddy ', false);
|
|
131
131
|
output_1.default.normal('set to ', false);
|
|
132
|
-
output_1.default.
|
|
132
|
+
output_1.default.light(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.light(remote);
|
|
144
144
|
}
|
|
145
145
|
else {
|
|
146
146
|
return;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 cfg_1 = __importDefault(require("../../tunnel/cfg"));
|
|
7
|
+
const output_1 = __importDefault(require("../../output"));
|
|
8
|
+
const texts_1 = require("../../texts");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const input_1 = __importDefault(require("../../input"));
|
|
11
|
+
const commandProjectSet = (0, utils_1.newCommand)('set', texts_1.DESC_COMMAND_PROJECT_SET);
|
|
12
|
+
commandProjectSet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
+
commandProjectSet.argument('[project]', texts_1.ARG_COMMAND_PROJECT_NAME);
|
|
14
|
+
commandProjectSet.action(async (project, options) => {
|
|
15
|
+
output_1.default.handleSignals();
|
|
16
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
+
const client = input_1.default.restApiTokenClient();
|
|
18
|
+
if (project) {
|
|
19
|
+
await client.getProject(workspace, project);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const response = await client.getProjects(workspace);
|
|
23
|
+
project = await output_1.default.selectProject(response.projects);
|
|
24
|
+
}
|
|
25
|
+
cfg_1.default.setProject(project);
|
|
26
|
+
if (!project)
|
|
27
|
+
output_1.default.exitSuccess(texts_1.TXT_PROJECT_SET_CLEARED);
|
|
28
|
+
else
|
|
29
|
+
output_1.default.exitSuccess((0, texts_1.TXT_PROJECT_SET_SUCCESS)(project));
|
|
30
|
+
});
|
|
31
|
+
exports.default = commandProjectSet;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 commandSandboxGetYaml = (0, utils_1.newCommand)('yaml', texts_1.DESC_COMMAND_SANDBOX_GET_YAML);
|
|
11
|
+
commandSandboxGetYaml.hideVersionUpdate = true;
|
|
12
|
+
commandSandboxGetYaml.alias('yml');
|
|
13
|
+
commandSandboxGetYaml.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
14
|
+
commandSandboxGetYaml.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
15
|
+
commandSandboxGetYaml.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
|
+
commandSandboxGetYaml.action(async (identifier, options) => {
|
|
17
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
|
+
const project = input_1.default.restApiProject(options.project);
|
|
19
|
+
const client = input_1.default.restApiTokenClient();
|
|
20
|
+
let result = await client.listSandboxes(workspace, project);
|
|
21
|
+
const sandboxes = result.sandboxes || [];
|
|
22
|
+
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
+
if (!found) {
|
|
24
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
|
+
}
|
|
26
|
+
const sandboxId = found.id;
|
|
27
|
+
result = await client.getSandboxYaml(workspace, sandboxId);
|
|
28
|
+
output_1.default.exitNormal(Buffer.from(result.yaml, 'base64').toString('utf8'));
|
|
29
|
+
});
|
|
30
|
+
exports.default = commandSandboxGetYaml;
|