bdy 1.22.25-dev-pipeline → 1.22.27-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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.25-dev-pipeline",
4
+ "version": "1.22.27-dev-pipeline",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -45,6 +45,7 @@
45
45
  "content-disposition": "0.5.4",
46
46
  "cookie": "1.1.1",
47
47
  "cross-spawn": "7.0.6",
48
+ "dotenv": "16.6.1",
48
49
  "eventsource": "4.1.0",
49
50
  "fastify": "5.8.5",
50
51
  "fdir": "6.5.0",
@@ -42,6 +42,7 @@ const punycode_1 = __importDefault(require("punycode/"));
42
42
  const node_fs_1 = __importStar(require("node:fs"));
43
43
  const tls_1 = __importDefault(require("tls"));
44
44
  const node_crypto_1 = __importDefault(require("node:crypto"));
45
+ const dotenv_1 = __importDefault(require("dotenv"));
45
46
  const utils_1 = require("./utils");
46
47
  const texts_1 = require("./texts");
47
48
  const tunnel_1 = require("./types/tunnel");
@@ -420,56 +421,36 @@ class Input {
420
421
  output_1.default.exitError(texts_1.ERR_RUN_PIPELINE_WRONG_DELAY);
421
422
  }
422
423
  static pipelineRunVariablesFromFile(p, encrypted) {
423
- const list = [];
424
424
  const s = (0, node_path_1.resolve)(p);
425
425
  if (!node_fs_1.default.existsSync(s)) {
426
426
  output_1.default.exitError(texts_1.ERR_PIPELINE_RUN_VAR_FILE_NOT_FOUND);
427
427
  }
428
- let lines;
428
+ let parsed;
429
429
  try {
430
- lines = node_fs_1.default.readFileSync(s, 'utf8').split(/\r?\n/);
430
+ parsed = dotenv_1.default.parse(node_fs_1.default.readFileSync(s));
431
431
  }
432
- catch (err) {
433
- if (err.code === 'ENOENT')
434
- output_1.default.exitError(texts_1.ERR_PIPELINE_RUN_VAR_FILE_NOT_FOUND);
432
+ catch {
435
433
  output_1.default.exitError(texts_1.ERR_PIPELINE_RUN_VAR_FILE_INVALID);
436
434
  }
437
- for (let i = 0; i < lines.length; i += 1) {
438
- const line = lines[i].trim();
439
- if (line.startsWith('#'))
440
- continue;
441
- if (line) {
442
- const ci = line.indexOf(':');
443
- const ei = line.indexOf('=');
444
- const sep = ci >= 0 && (ei < 0 || ci < ei) ? ':' : '=';
445
- const l = line.split(sep);
446
- if (l.length < 2) {
447
- output_1.default.exitError(texts_1.ERR_PIPELINE_RUN_VAR_FILE_INVALID);
448
- }
449
- const key = l.shift().trim();
450
- const value = l.join(sep).trim();
451
- if (!key) {
452
- output_1.default.exitError(texts_1.ERR_PIPELINE_RUN_VAR_FILE_INVALID);
453
- }
454
- list.push({
455
- key,
456
- value,
457
- encrypted
458
- });
459
- }
460
- }
461
- return list;
435
+ return Object.entries(parsed).map(([key, value]) => ({
436
+ key,
437
+ value,
438
+ encrypted,
439
+ }));
462
440
  }
463
441
  static pipelineRunVariable(variable, encrypted) {
464
442
  const list = [];
465
443
  variable.forEach((v) => {
466
- const s = v.split(':');
444
+ const ei = v.indexOf('=');
445
+ const ci = v.indexOf(':');
446
+ const sep = ei >= 0 && (ci < 0 || ei < ci) ? '=' : ':';
447
+ const s = v.split(sep);
467
448
  if (s.length < 2) {
468
449
  output_1.default.exitError((0, texts_1.ERR_RUN_PIPELINE_WRONG_VARIABLE)(v));
469
450
  }
470
451
  list.push({
471
- key: s.shift() || '',
472
- value: s.join(':'),
452
+ key: (s.shift() || '').trim(),
453
+ value: s.join(sep).trim(),
473
454
  encrypted,
474
455
  });
475
456
  });
@@ -471,7 +471,7 @@ class OutputPipeline {
471
471
  static _jsonActionsLogsHelp(identifier, runId, actionRunId) {
472
472
  if (!actionRunId)
473
473
  actionRunId = '<action-run-id>';
474
- return `To view action logs run: \`bdy pip run logs ${identifier} ${runId} ${actionRunId}\``;
474
+ return `To view action logs run: \`bdy pip run logs ${identifier} ${runId} ${actionRunId} --format jsonl\``;
475
475
  }
476
476
  static _runDetailsFinished(status, finished, tabs) {
477
477
  if (finished &&
@@ -1105,13 +1105,21 @@ class OutputPipeline {
1105
1105
  const a = {
1106
1106
  ...action,
1107
1107
  };
1108
- if (action.runId) {
1108
+ if (action.runId && !a.logs) {
1109
1109
  a.logs = this._jsonActionsLogsHelp(identifier, runId, action.runId);
1110
1110
  }
1111
1111
  output_1.default.json({ type: 'action', action: a });
1112
1112
  }
1113
- static jsonRun(run) {
1114
- output_1.default.json({ type: 'run', run });
1113
+ static jsonRun(identifier, run) {
1114
+ const r = {
1115
+ ...run,
1116
+ };
1117
+ (r.actions || []).forEach((a) => {
1118
+ if (a.runId && !a.logs) {
1119
+ a.logs = this._jsonActionsLogsHelp(identifier, run.runId, a.runId);
1120
+ }
1121
+ });
1122
+ output_1.default.json({ type: 'run', run: r });
1115
1123
  }
1116
1124
  static jsonLog(log) {
1117
1125
  output_1.default.json({ type: 'log', log });
@@ -1328,7 +1336,7 @@ class OutputPipeline {
1328
1336
  totalFetchesCount += 1;
1329
1337
  if (!noFollow || noWait) {
1330
1338
  if (isJson)
1331
- this.jsonRun(run);
1339
+ this.jsonRun(identifier, run);
1332
1340
  else
1333
1341
  draw(run);
1334
1342
  }
@@ -1337,7 +1345,7 @@ class OutputPipeline {
1337
1345
  }
1338
1346
  });
1339
1347
  if (isJson) {
1340
- this.jsonRun(run);
1348
+ this.jsonRun(identifier, run);
1341
1349
  this.jsonInfo(this._jsonActionsLogsHelp(identifier, runId));
1342
1350
  }
1343
1351
  else {
@@ -371,8 +371,8 @@ exports.OPTION_PIPELINE_RUN_COMMENT = 'Run comment';
371
371
  exports.OPTION_PIPELINE_RUN_REFRESH = 'Deploy from scratch';
372
372
  exports.OPTION_PIPELINE_RUN_CLEAR_CACHE = 'Clear cache before running the pipeline';
373
373
  exports.OPTION_PIPELINE_RUN_PRIORITY = 'Run priority. Can be one of "LOW", "NORMAL" or "HIGH". Default is "NORMAL"';
374
- exports.OPTION_PIPELINE_RUN_VAR = 'Variable key:value. Can be passed multiple times to pass multiple variables';
375
- exports.OPTION_PIPELINE_RUN_VAR_FILE = 'File with variables, key:value or key=value. Each variable in new line';
374
+ exports.OPTION_PIPELINE_RUN_VAR = 'Variable key=value or key:value. Can be passed multiple times to pass multiple variables';
375
+ exports.OPTION_PIPELINE_RUN_VAR_FILE = 'File with variables, key=value. Each variable in new line';
376
376
  exports.ERR_PIPELINE_RUN_VAR_FILE_NOT_FOUND = 'File with variables not found';
377
377
  exports.ERR_PIPELINE_RUN_VAR_FILE_INVALID = 'File with variables invalid';
378
378
  exports.OPTION_PIPELINE_RUN_DELAY = 'The date when the execution should be run. Should be set in the format: 2016-11-18T12:38:16.000Z or 30s, 10m, 3h10m30s';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.25-dev-pipeline",
4
+ "version": "1.22.27-dev-pipeline",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -45,6 +45,7 @@
45
45
  "content-disposition": "0.5.4",
46
46
  "cookie": "1.1.1",
47
47
  "cross-spawn": "7.0.6",
48
+ "dotenv": "16.6.1",
48
49
  "eventsource": "4.1.0",
49
50
  "fastify": "5.8.5",
50
51
  "fdir": "6.5.0",