@catladder/cli 0.0.0-main-ed835115 → 0.0.0-main-8a770211

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.
@@ -5772,16 +5772,16 @@ exports.createRailsBuildJobs = createRailsBuildJobs;
5772
5772
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5773
5773
  exports.createRailsJobs = void 0;
5774
5774
  const build_1 = __nccwpck_require__(67261);
5775
- const test_1 = __nccwpck_require__(47910);
5775
+ const testJob_1 = __nccwpck_require__(65771);
5776
5776
  const createRailsJobs = (context) => {
5777
- return [...(0, test_1.createRailsTestJobs)(context), ...(0, build_1.createRailsBuildJobs)(context)];
5777
+ return [...(0, testJob_1.createRailsTestJobs)(context), ...(0, build_1.createRailsBuildJobs)(context)];
5778
5778
  };
5779
5779
  exports.createRailsJobs = createRailsJobs;
5780
5780
  //# sourceMappingURL=index.js.map
5781
5781
 
5782
5782
  /***/ }),
5783
5783
 
5784
- /***/ 47910:
5784
+ /***/ 65771:
5785
5785
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
5786
5786
 
5787
5787
  "use strict";
@@ -5888,7 +5888,7 @@ const createRailsTestJobs = (context) => {
5888
5888
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
5889
5889
  };
5890
5890
  exports.createRailsTestJobs = createRailsTestJobs;
5891
- //# sourceMappingURL=test.js.map
5891
+ //# sourceMappingURL=testJob.js.map
5892
5892
 
5893
5893
  /***/ }),
5894
5894
 
@@ -7466,6 +7466,7 @@ exports.ENV_VARS_FILENAME = "____envvars.yaml";
7466
7466
 
7467
7467
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7468
7468
  exports.getOnDeployExecuteScript = void 0;
7469
+ const utils_1 = __nccwpck_require__(32497);
7469
7470
  const createArgsString_1 = __nccwpck_require__(49598);
7470
7471
  const getJobOrServiceArgs_1 = __nccwpck_require__(61741);
7471
7472
  const jobName_1 = __nccwpck_require__(9626);
@@ -7475,7 +7476,7 @@ const getOnDeployExecuteScript = (context, when) => {
7475
7476
  const executes = getExecutes(context);
7476
7477
  return executes
7477
7478
  .filter(({ config }) => config.when === when)
7478
- .map((execute) => {
7479
+ .flatMap((execute) => {
7479
7480
  return getJobRunScriptForExecute(context, execute);
7480
7481
  });
7481
7482
  };
@@ -7486,7 +7487,8 @@ const getExecutes = (context) => {
7486
7487
  return [
7487
7488
  ...getLegacyExecutes(context),
7488
7489
  ...Object.entries((_a = deployConfig.execute) !== null && _a !== void 0 ? _a : {}).flatMap(([key, value]) => {
7489
- if (!value || (value.when !== "schedule" && value.type !== "job")) {
7490
+ // remove all schedule executes
7491
+ if (!value) {
7490
7492
  return [];
7491
7493
  }
7492
7494
  return [
@@ -7524,21 +7526,30 @@ const getLegacyExecutes = (context) => {
7524
7526
  };
7525
7527
  const getJobRunScriptForExecute = (context, { jobName, config }) => {
7526
7528
  var _a;
7527
- const commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
7528
- // always wait for completion for preStop and postStop jobs
7529
- // since stop will delete the jobs afterwards, so they will fail
7530
- const waitForCompletion = ["preStop", "postStop"].includes(config.when)
7531
- ? true // always
7532
- : "waitForCompletion" in config
7533
- ? ((_a = config.waitForCompletion) !== null && _a !== void 0 ? _a : false) // depends on config
7534
- : false;
7535
- const argString = (0, createArgsString_1.createArgsString)({
7536
- ...commonArgs,
7537
- wait: waitForCompletion === true ? true : undefined,
7538
- args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args),
7539
- });
7540
- const fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
7541
- return `${(0, common_1.gcloudRunCmd)()} jobs execute ${fullJobName.toString()} ${argString}`;
7529
+ const type = config.type;
7530
+ if (type === "script") {
7531
+ return (0, utils_1.ensureArray)(config.script);
7532
+ }
7533
+ else if (type === "job") {
7534
+ const commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
7535
+ // always wait for completion for preStop and postStop jobs
7536
+ // since stop will delete the jobs afterwards, so they will fail
7537
+ const waitForCompletion = ["preStop", "postStop"].includes(config.when)
7538
+ ? true // always
7539
+ : "waitForCompletion" in config
7540
+ ? ((_a = config.waitForCompletion) !== null && _a !== void 0 ? _a : false) // depends on config
7541
+ : false;
7542
+ const argString = (0, createArgsString_1.createArgsString)({
7543
+ ...commonArgs,
7544
+ wait: waitForCompletion === true ? true : undefined,
7545
+ args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args),
7546
+ });
7547
+ const fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
7548
+ return [
7549
+ `${(0, common_1.gcloudRunCmd)()} jobs execute ${fullJobName.toString()} ${argString}`,
7550
+ ];
7551
+ }
7552
+ throw new Error(`unsupported execute type: ${type}`);
7542
7553
  };
7543
7554
  //# sourceMappingURL=onDeploy.js.map
7544
7555
 
@@ -120278,6 +120289,120 @@ class AggregateError extends Error {
120278
120289
  module.exports = AggregateError;
120279
120290
 
120280
120291
 
120292
+ /***/ }),
120293
+
120294
+ /***/ 56575:
120295
+ /***/ ((module) => {
120296
+
120297
+ "use strict";
120298
+
120299
+ var ESC = '\u001b[';
120300
+ var x = module.exports;
120301
+
120302
+ x.cursorTo = function (x, y) {
120303
+ if (arguments.length === 0) {
120304
+ return ESC + 'H';
120305
+ }
120306
+
120307
+ if (arguments.length === 1) {
120308
+ return ESC + (x + 1) + 'G';
120309
+ }
120310
+
120311
+ return ESC + (y + 1) + ';' + (x + 1) + 'H';
120312
+ };
120313
+
120314
+ x.cursorMove = function (x, y) {
120315
+ var ret = '';
120316
+
120317
+ if (x < 0) {
120318
+ ret += ESC + (-x) + 'D';
120319
+ } else if (x > 0) {
120320
+ ret += ESC + x + 'C';
120321
+ }
120322
+
120323
+ if (y < 0) {
120324
+ ret += ESC + (-y) + 'A';
120325
+ } else if (y > 0) {
120326
+ ret += ESC + y + 'B';
120327
+ }
120328
+
120329
+ return ret;
120330
+ };
120331
+
120332
+ x.cursorUp = function (count) {
120333
+ return ESC + (typeof count === 'number' ? count : 1) + 'A';
120334
+ };
120335
+
120336
+ x.cursorDown = function (count) {
120337
+ return ESC + (typeof count === 'number' ? count : 1) + 'B';
120338
+ };
120339
+
120340
+ x.cursorForward = function (count) {
120341
+ return ESC + (typeof count === 'number' ? count : 1) + 'C';
120342
+ };
120343
+
120344
+ x.cursorBackward = function (count) {
120345
+ return ESC + (typeof count === 'number' ? count : 1) + 'D';
120346
+ };
120347
+
120348
+ x.cursorLeft = ESC + '1000D';
120349
+ x.cursorSavePosition = ESC + 's';
120350
+ x.cursorRestorePosition = ESC + 'u';
120351
+ x.cursorGetPosition = ESC + '6n';
120352
+ x.cursorNextLine = ESC + 'E';
120353
+ x.cursorPrevLine = ESC + 'F';
120354
+ x.cursorHide = ESC + '?25l';
120355
+ x.cursorShow = ESC + '?25h';
120356
+
120357
+ x.eraseLines = function (count) {
120358
+ var clear = '';
120359
+
120360
+ for (var i = 0; i < count; i++) {
120361
+ clear += x.cursorLeft + x.eraseEndLine + (i < count - 1 ? x.cursorUp() : '');
120362
+ }
120363
+
120364
+ return clear;
120365
+ };
120366
+
120367
+ x.eraseEndLine = ESC + 'K';
120368
+ x.eraseStartLine = ESC + '1K';
120369
+ x.eraseLine = ESC + '2K';
120370
+ x.eraseDown = ESC + 'J';
120371
+ x.eraseUp = ESC + '1J';
120372
+ x.eraseScreen = ESC + '2J';
120373
+ x.scrollUp = ESC + 'S';
120374
+ x.scrollDown = ESC + 'T';
120375
+
120376
+ x.clearScreen = '\u001bc';
120377
+ x.beep = '\u0007';
120378
+
120379
+ x.image = function (buf, opts) {
120380
+ opts = opts || {};
120381
+
120382
+ var ret = '\u001b]1337;File=inline=1';
120383
+
120384
+ if (opts.width) {
120385
+ ret += ';width=' + opts.width;
120386
+ }
120387
+
120388
+ if (opts.height) {
120389
+ ret += ';height=' + opts.height;
120390
+ }
120391
+
120392
+ if (opts.preserveAspectRatio === false) {
120393
+ ret += ';preserveAspectRatio=0';
120394
+ }
120395
+
120396
+ return ret + ':' + buf.toString('base64') + '\u0007';
120397
+ };
120398
+
120399
+ x.iTerm = {};
120400
+
120401
+ x.iTerm.setCwd = function (cwd) {
120402
+ return '\u001b]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';
120403
+ };
120404
+
120405
+
120281
120406
  /***/ }),
120282
120407
 
120283
120408
  /***/ 45067:
@@ -188071,7 +188196,7 @@ Paginator.prototype.paginate = function (output, active) {
188071
188196
 
188072
188197
  "use strict";
188073
188198
 
188074
- var ansiEscapes = __nccwpck_require__(14497);
188199
+ var ansiEscapes = __nccwpck_require__(56575);
188075
188200
 
188076
188201
  /**
188077
188202
  * Move cursor left by `x`
@@ -188299,120 +188424,6 @@ exports.fetchAsyncQuestionProperty = function (question, prop, answers) {
188299
188424
  };
188300
188425
 
188301
188426
 
188302
- /***/ }),
188303
-
188304
- /***/ 14497:
188305
- /***/ ((module) => {
188306
-
188307
- "use strict";
188308
-
188309
- var ESC = '\u001b[';
188310
- var x = module.exports;
188311
-
188312
- x.cursorTo = function (x, y) {
188313
- if (arguments.length === 0) {
188314
- return ESC + 'H';
188315
- }
188316
-
188317
- if (arguments.length === 1) {
188318
- return ESC + (x + 1) + 'G';
188319
- }
188320
-
188321
- return ESC + (y + 1) + ';' + (x + 1) + 'H';
188322
- };
188323
-
188324
- x.cursorMove = function (x, y) {
188325
- var ret = '';
188326
-
188327
- if (x < 0) {
188328
- ret += ESC + (-x) + 'D';
188329
- } else if (x > 0) {
188330
- ret += ESC + x + 'C';
188331
- }
188332
-
188333
- if (y < 0) {
188334
- ret += ESC + (-y) + 'A';
188335
- } else if (y > 0) {
188336
- ret += ESC + y + 'B';
188337
- }
188338
-
188339
- return ret;
188340
- };
188341
-
188342
- x.cursorUp = function (count) {
188343
- return ESC + (typeof count === 'number' ? count : 1) + 'A';
188344
- };
188345
-
188346
- x.cursorDown = function (count) {
188347
- return ESC + (typeof count === 'number' ? count : 1) + 'B';
188348
- };
188349
-
188350
- x.cursorForward = function (count) {
188351
- return ESC + (typeof count === 'number' ? count : 1) + 'C';
188352
- };
188353
-
188354
- x.cursorBackward = function (count) {
188355
- return ESC + (typeof count === 'number' ? count : 1) + 'D';
188356
- };
188357
-
188358
- x.cursorLeft = ESC + '1000D';
188359
- x.cursorSavePosition = ESC + 's';
188360
- x.cursorRestorePosition = ESC + 'u';
188361
- x.cursorGetPosition = ESC + '6n';
188362
- x.cursorNextLine = ESC + 'E';
188363
- x.cursorPrevLine = ESC + 'F';
188364
- x.cursorHide = ESC + '?25l';
188365
- x.cursorShow = ESC + '?25h';
188366
-
188367
- x.eraseLines = function (count) {
188368
- var clear = '';
188369
-
188370
- for (var i = 0; i < count; i++) {
188371
- clear += x.cursorLeft + x.eraseEndLine + (i < count - 1 ? x.cursorUp() : '');
188372
- }
188373
-
188374
- return clear;
188375
- };
188376
-
188377
- x.eraseEndLine = ESC + 'K';
188378
- x.eraseStartLine = ESC + '1K';
188379
- x.eraseLine = ESC + '2K';
188380
- x.eraseDown = ESC + 'J';
188381
- x.eraseUp = ESC + '1J';
188382
- x.eraseScreen = ESC + '2J';
188383
- x.scrollUp = ESC + 'S';
188384
- x.scrollDown = ESC + 'T';
188385
-
188386
- x.clearScreen = '\u001bc';
188387
- x.beep = '\u0007';
188388
-
188389
- x.image = function (buf, opts) {
188390
- opts = opts || {};
188391
-
188392
- var ret = '\u001b]1337;File=inline=1';
188393
-
188394
- if (opts.width) {
188395
- ret += ';width=' + opts.width;
188396
- }
188397
-
188398
- if (opts.height) {
188399
- ret += ';height=' + opts.height;
188400
- }
188401
-
188402
- if (opts.preserveAspectRatio === false) {
188403
- ret += ';preserveAspectRatio=0';
188404
- }
188405
-
188406
- return ret + ':' + buf.toString('base64') + '\u0007';
188407
- };
188408
-
188409
- x.iTerm = {};
188410
-
188411
- x.iTerm.setCwd = function (cwd) {
188412
- return '\u001b]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';
188413
- };
188414
-
188415
-
188416
188427
  /***/ }),
188417
188428
 
188418
188429
  /***/ 86695:
@@ -291130,120 +291141,6 @@ Object.defineProperty(vorpal, 'activeCommand', {
291130
291141
  }
291131
291142
  });
291132
291143
 
291133
- /***/ }),
291134
-
291135
- /***/ 37374:
291136
- /***/ ((module) => {
291137
-
291138
- "use strict";
291139
-
291140
- var ESC = '\u001b[';
291141
- var x = module.exports;
291142
-
291143
- x.cursorTo = function (x, y) {
291144
- if (arguments.length === 0) {
291145
- return ESC + 'H';
291146
- }
291147
-
291148
- if (arguments.length === 1) {
291149
- return ESC + (x + 1) + 'G';
291150
- }
291151
-
291152
- return ESC + (y + 1) + ';' + (x + 1) + 'H';
291153
- };
291154
-
291155
- x.cursorMove = function (x, y) {
291156
- var ret = '';
291157
-
291158
- if (x < 0) {
291159
- ret += ESC + (-x) + 'D';
291160
- } else if (x > 0) {
291161
- ret += ESC + x + 'C';
291162
- }
291163
-
291164
- if (y < 0) {
291165
- ret += ESC + (-y) + 'A';
291166
- } else if (y > 0) {
291167
- ret += ESC + y + 'B';
291168
- }
291169
-
291170
- return ret;
291171
- };
291172
-
291173
- x.cursorUp = function (count) {
291174
- return ESC + (typeof count === 'number' ? count : 1) + 'A';
291175
- };
291176
-
291177
- x.cursorDown = function (count) {
291178
- return ESC + (typeof count === 'number' ? count : 1) + 'B';
291179
- };
291180
-
291181
- x.cursorForward = function (count) {
291182
- return ESC + (typeof count === 'number' ? count : 1) + 'C';
291183
- };
291184
-
291185
- x.cursorBackward = function (count) {
291186
- return ESC + (typeof count === 'number' ? count : 1) + 'D';
291187
- };
291188
-
291189
- x.cursorLeft = ESC + '1000D';
291190
- x.cursorSavePosition = ESC + 's';
291191
- x.cursorRestorePosition = ESC + 'u';
291192
- x.cursorGetPosition = ESC + '6n';
291193
- x.cursorNextLine = ESC + 'E';
291194
- x.cursorPrevLine = ESC + 'F';
291195
- x.cursorHide = ESC + '?25l';
291196
- x.cursorShow = ESC + '?25h';
291197
-
291198
- x.eraseLines = function (count) {
291199
- var clear = '';
291200
-
291201
- for (var i = 0; i < count; i++) {
291202
- clear += x.cursorLeft + x.eraseEndLine + (i < count - 1 ? x.cursorUp() : '');
291203
- }
291204
-
291205
- return clear;
291206
- };
291207
-
291208
- x.eraseEndLine = ESC + 'K';
291209
- x.eraseStartLine = ESC + '1K';
291210
- x.eraseLine = ESC + '2K';
291211
- x.eraseDown = ESC + 'J';
291212
- x.eraseUp = ESC + '1J';
291213
- x.eraseScreen = ESC + '2J';
291214
- x.scrollUp = ESC + 'S';
291215
- x.scrollDown = ESC + 'T';
291216
-
291217
- x.clearScreen = '\u001bc';
291218
- x.beep = '\u0007';
291219
-
291220
- x.image = function (buf, opts) {
291221
- opts = opts || {};
291222
-
291223
- var ret = '\u001b]1337;File=inline=1';
291224
-
291225
- if (opts.width) {
291226
- ret += ';width=' + opts.width;
291227
- }
291228
-
291229
- if (opts.height) {
291230
- ret += ';height=' + opts.height;
291231
- }
291232
-
291233
- if (opts.preserveAspectRatio === false) {
291234
- ret += ';preserveAspectRatio=0';
291235
- }
291236
-
291237
- return ret + ':' + buf.toString('base64') + '\u0007';
291238
- };
291239
-
291240
- x.iTerm = {};
291241
-
291242
- x.iTerm.setCwd = function (cwd) {
291243
- return '\u001b]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';
291244
- };
291245
-
291246
-
291247
291144
  /***/ }),
291248
291145
 
291249
291146
  /***/ 41982:
@@ -291522,7 +291419,7 @@ module.exports = function (x) {
291522
291419
 
291523
291420
  "use strict";
291524
291421
 
291525
- var ansiEscapes = __nccwpck_require__(37374);
291422
+ var ansiEscapes = __nccwpck_require__(56575);
291526
291423
  var cliCursor = __nccwpck_require__(22701);
291527
291424
 
291528
291425
  function main(stream) {
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createRailsJobs = void 0;
4
4
  const build_1 = require("./build");
5
- const test_1 = require("./test");
5
+ const testJob_1 = require("./testJob");
6
6
  const createRailsJobs = (context) => {
7
- return [...(0, test_1.createRailsTestJobs)(context), ...(0, build_1.createRailsBuildJobs)(context)];
7
+ return [...(0, testJob_1.createRailsTestJobs)(context), ...(0, build_1.createRailsBuildJobs)(context)];
8
8
  };
9
9
  exports.createRailsJobs = createRailsJobs;
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/rails/index.ts"],"names":[],"mappings":";;;AAEA,mCAA+C;AAC/C,iCAA6C;AAEtC,MAAM,eAAe,GAAG,CAC7B,OAAkC,EAClB,EAAE;IAClB,OAAO,CAAC,GAAG,IAAA,0BAAmB,EAAC,OAAO,CAAC,EAAE,GAAG,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/rails/index.ts"],"names":[],"mappings":";;;AAEA,mCAA+C;AAC/C,uCAAgD;AAEzC,MAAM,eAAe,GAAG,CAC7B,OAAkC,EAClB,EAAE;IAClB,OAAO,CAAC,GAAG,IAAA,6BAAmB,EAAC,OAAO,CAAC,EAAE,GAAG,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B"}
@@ -101,4 +101,4 @@ const createRailsTestJobs = (context) => {
101
101
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
102
102
  };
103
103
  exports.createRailsTestJobs = createRailsTestJobs;
104
- //# sourceMappingURL=test.js.map
104
+ //# sourceMappingURL=testJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testJob.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/rails/testJob.ts"],"names":[],"mappings":";;;AAAA,6BAGe;AAEf,uCAAwD;AAEjD,MAAM,mBAAmB,GAAG,CACjC,OAAyB,EACT,EAAE;;IAClB,gCAAgC;IAChC,6CAA6C;IAC7C,IAAI,OAAO,CAAC,OAAO,KAA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AW,CAAE,IAAI,0CAAE,aAAa,mCACjC,2BAA2B,CAAC;wBAC9B,CAAC,CAAC,2BAA2B;oBACjC,KAAK,EAAE,UAAU;oBACjB,SAAS,EAAE;wBACT,yBAAyB,EAAE,OAAO;qBACnC;iBACF;aACF;SACF;QACH,CAAC,CAAC,IAAI,CAAC;IACX,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,cAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AAhHW,QAAA,mBAAmB,uBAgH9B"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOnDeployExecuteScript = void 0;
4
+ const utils_1 = require("../../../../utils");
4
5
  const createArgsString_1 = require("../../utils/createArgsString");
5
6
  const getJobOrServiceArgs_1 = require("../../utils/getJobOrServiceArgs");
6
7
  const jobName_1 = require("../../utils/jobName");
@@ -10,7 +11,7 @@ const getOnDeployExecuteScript = (context, when) => {
10
11
  const executes = getExecutes(context);
11
12
  return executes
12
13
  .filter(({ config }) => config.when === when)
13
- .map((execute) => {
14
+ .flatMap((execute) => {
14
15
  return getJobRunScriptForExecute(context, execute);
15
16
  });
16
17
  };
@@ -21,7 +22,8 @@ const getExecutes = (context) => {
21
22
  return [
22
23
  ...getLegacyExecutes(context),
23
24
  ...Object.entries((_a = deployConfig.execute) !== null && _a !== void 0 ? _a : {}).flatMap(([key, value]) => {
24
- if (!value || (value.when !== "schedule" && value.type !== "job")) {
25
+ // remove all schedule executes
26
+ if (!value) {
25
27
  return [];
26
28
  }
27
29
  return [
@@ -59,20 +61,29 @@ const getLegacyExecutes = (context) => {
59
61
  };
60
62
  const getJobRunScriptForExecute = (context, { jobName, config }) => {
61
63
  var _a;
62
- const commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
63
- // always wait for completion for preStop and postStop jobs
64
- // since stop will delete the jobs afterwards, so they will fail
65
- const waitForCompletion = ["preStop", "postStop"].includes(config.when)
66
- ? true // always
67
- : "waitForCompletion" in config
68
- ? ((_a = config.waitForCompletion) !== null && _a !== void 0 ? _a : false) // depends on config
69
- : false;
70
- const argString = (0, createArgsString_1.createArgsString)({
71
- ...commonArgs,
72
- wait: waitForCompletion === true ? true : undefined,
73
- args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args),
74
- });
75
- const fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
76
- return `${(0, common_1.gcloudRunCmd)()} jobs execute ${fullJobName.toString()} ${argString}`;
64
+ const type = config.type;
65
+ if (type === "script") {
66
+ return (0, utils_1.ensureArray)(config.script);
67
+ }
68
+ else if (type === "job") {
69
+ const commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
70
+ // always wait for completion for preStop and postStop jobs
71
+ // since stop will delete the jobs afterwards, so they will fail
72
+ const waitForCompletion = ["preStop", "postStop"].includes(config.when)
73
+ ? true // always
74
+ : "waitForCompletion" in config
75
+ ? ((_a = config.waitForCompletion) !== null && _a !== void 0 ? _a : false) // depends on config
76
+ : false;
77
+ const argString = (0, createArgsString_1.createArgsString)({
78
+ ...commonArgs,
79
+ wait: waitForCompletion === true ? true : undefined,
80
+ args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args),
81
+ });
82
+ const fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
83
+ return [
84
+ `${(0, common_1.gcloudRunCmd)()} jobs execute ${fullJobName.toString()} ${argString}`,
85
+ ];
86
+ }
87
+ throw new Error(`unsupported execute type: ${type}`);
77
88
  };
78
89
  //# sourceMappingURL=onDeploy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"onDeploy.js","sourceRoot":"","sources":["../../../../../../../../pipeline/src/deploy/cloudRun/createJobs/execute/onDeploy.ts"],"names":[],"mappings":";;;AAOA,mEAAgE;AAChE,yEAAiF;AACjF,iDAAqD;AACrD,kDAA2D;AAC3D,sCAImB;AAMZ,MAAM,wBAAwB,GAAG,CACtC,OA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wBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,GAAG,IAAA,qBAAY,GAAE,iBAAiB,WAAW,CAAC,QAAQ,EAAE,IAAI,SAAS,EAAE,CAAC;AACjF,CAAC,CAAC"}
1
+ {"version":3,"file":"onDeploy.js","sourceRoot":"","sources":["../../../../../../../../pipeline/src/deploy/cloudRun/createJobs/execute/onDeploy.ts"],"names":[],"mappings":";;;AAEA,6CAAgD;AAGhD,mEAAgE;AAChE,yEAAiF;AACjF,iDAAqD;AACrD,kDAA2D;AAC3D,sCAImB;AAMZ,MAAM,wBAAwB,GAAG,CACtC,OAAyB,EACzB,IAAiD,EACjD,EAAE;IACF,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,QAAQ;SACZ,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;SAC5C,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnB,OAAO,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAXW,QAAA,wBAAwB,4BAWnC;AAEF,MAAM,WAAW,GAAG,CAAC,OAAyB,EAAa,EAAE;;IAC3D,MAAM,YAAY,GAAG,IAAA,gCAAuB,EAAC,OAAO,CAAC,CAAC;IACtD,OAAO;QACL,GAAG,iBAAiB,CAAC,OAAO,CAAC;QAC7B,GAAG,MAAM,CAAC,OAAO,CAAC,MAAA,YAAY,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACrE,+BAA+B;YAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO;gBACL;oBACE,OAAO,EAAE,GAAG;oBACZ,MAAM,EAAE,KAAK;iBACH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B,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;YACrE,CAAC,CAAC,IAAI,CAAC,SAAS;YAChB,CAAC,CAAC,mBAAmB,IAAI,MAAM;gBAC7B,CAAC,CAAC,CAAC,MAAA,MAAM,CAAC,iBAAiB,mCAAI,KAAK,CAAC,CAAC,oBAAoB;gBAC1D,CAAC,CAAC,KAAK,CAAC;QAEZ,MAAM,SAAS,GAAG,IAAA,mCAAgB,EAAC;YACjC,GAAG,UAAU;YACb,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YACnD,IAAI,EAAE,IAAA,oDAA8B,EAAC,MAAM,CAAC,IAAI,CAAC;SAClD,CAAC,CAAC;QACH,MAAM,WAAW,GAAG,IAAA,wBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,OAAO;YACL,GAAG,IAAA,qBAAY,GAAE,iBAAiB,WAAW,CAAC,QAAQ,EAAE,IAAI,SAAS,EAAE;SACxE,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ type DeployConfigBaseExecuteScript = {
2
+ type: "script";
3
+ script: string | string[];
4
+ };
5
+ /**
6
+ * currently only supported for cloud run deployments
7
+ */
8
+ export type DeployConfigBaseExecuteOnDeploy = DeployConfigBaseExecuteScript & ({
9
+ /**
10
+ * run the job before or after the deploy
11
+ */
12
+ when: "preDeploy" | "postDeploy";
13
+ /**
14
+ * whether to wait for completion of the job
15
+ */
16
+ waitForCompletion?: boolean;
17
+ } | {
18
+ /**
19
+ * run the job before or after the environment is stopped
20
+ */
21
+ when: "preStop" | "postStop";
22
+ });
23
+ export type DeployConfigBaseExecute = DeployConfigBaseExecuteOnDeploy;
24
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=executeBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeBase.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/types/executeBase.ts"],"names":[],"mappings":""}
@@ -1,5 +1,6 @@
1
1
  import type { DBVariablesMode } from "../cloudRun/utils/database";
2
2
  import type { DeployConfigBase } from "./base";
3
+ import type { DeployConfigBaseExecute } from "./executeBase";
3
4
  export type Gcloudregion = "asia-east1" | "asia-northeast1" | "asia-northeast2" | "europe-north1" | "europe-southwest1" | "europe-west1" | "europe-west4" | "europe-west8" | "europe-west9" | "me-west1" | "us-central1" | "us-east1" | "us-east4" | "us-east5" | "us-south1" | "us-west1" | "asia-east2" | "asia-northeast3" | "asia-southeast1" | "asia-southeast2" | "asia-south1" | "asia-south2" | "australia-southeast1" | "australia-southeast2" | "europe-central2" | "europe-west2" | "europe-west3" | "europe-west6" | "northamerica-northeast1" | "northamerica-northeast2" | "southamerica-east1" | "southamerica-west1" | "us-west2" | "us-west3" | "us-west4";
4
5
  export type DeployConfigCloudRunCloudSql = {
5
6
  type: "unmanaged";
@@ -315,7 +316,7 @@ export type DeployConfigCloudRunWithVolumes = {
315
316
  volumes?: DeployConfigCloudRunVolumes;
316
317
  };
317
318
  export type DeployConfigCloudRunJob = DeployConfigCloudRunJobNormal | DeployConfigCloudRunJobWithSchedule;
318
- export type DeployConfigCloudRun = {
319
+ export type DeployConfigCloudRun = Omit<DeployConfigBase, "execute"> & {
319
320
  /**
320
321
  * cloud run deployment.
321
322
  *
@@ -354,7 +355,7 @@ export type DeployConfigCloudRun = {
354
355
  */
355
356
  execute?: Record<string, DeployConfigCloudRunExecute | null>;
356
357
  debug?: boolean;
357
- } & DeployConfigBase;
358
+ };
358
359
  export type DeployConfigCloudRunVolumes = Record<string, DeployConfigCloudRunVolume>;
359
360
  export type DeployConfigCloudRunVolume = {
360
361
  type: "cloud-storage";
@@ -409,7 +410,7 @@ export type DeployConfigCloudRunExecuteOnDeploy = DeployConfigCloudRunExecuteJob
409
410
  */
410
411
  when: "preStop" | "postStop";
411
412
  });
412
- export type DeployConfigCloudRunExecuteJob = DeployConfigCloudRunExecuteJobScheduled | DeployConfigCloudRunExecuteOnDeploy;
413
+ export type DeployConfigCloudRunExecuteJob = DeployConfigBaseExecute | DeployConfigCloudRunExecuteJobScheduled | DeployConfigCloudRunExecuteOnDeploy;
413
414
  export type DeployConfigCloudRunExecuteHttp = {
414
415
  /**
415
416
  * set to "http" to run a http request
@@ -432,6 +433,6 @@ export type DeployConfigCloudRunExecuteHttp = {
432
433
  */
433
434
  headers?: Record<string, string>;
434
435
  } & WithSchedule;
435
- export type DeployConfigCloudRunExecute = DeployConfigCloudRunExecuteJob | DeployConfigCloudRunExecuteHttp;
436
+ export type DeployConfigCloudRunExecute = DeployConfigBaseExecute | DeployConfigCloudRunExecuteJob | DeployConfigCloudRunExecuteHttp;
436
437
  export type DeployConfigCloudRunExecuteWithSchedule = Extract<DeployConfigCloudRunExecute, WithSchedule>;
437
438
  export {};