@catladder/cli 0.0.0-main-cda13e03 → 0.0.0-main-10fc114c
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/dist/bundles/catenv/index.js +34 -20
- package/dist/bundles/cli/index.js +34 -20
- package/dist/pipeline/src/build/node/yarn.js +6 -3
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +5 -0
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/onDeploy.js +28 -17
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/onDeploy.js.map +1 -1
- package/dist/pipeline/src/deploy/types/executeBase.d.ts +24 -0
- package/dist/pipeline/src/deploy/types/executeBase.js +3 -0
- package/dist/pipeline/src/deploy/types/executeBase.js.map +1 -0
- package/dist/pipeline/src/deploy/types/googleCloudRun.d.ts +5 -4
- package/dist/pipeline/src/deploy/types/googleCloudRun.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/pipeline/src/pipeline/yarn/yarnUtils.d.ts +0 -5
- package/dist/pipeline/src/pipeline/yarn/yarnUtils.js +0 -51
- package/dist/pipeline/src/pipeline/yarn/yarnUtils.js.map +0 -1
|
@@ -2415,7 +2415,7 @@ const getYarnInstall = (context, options) => {
|
|
|
2415
2415
|
exports.getYarnInstall = getYarnInstall;
|
|
2416
2416
|
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
2417
2417
|
const getDockerAppCopyAndBuildScript = (context) => {
|
|
2418
|
-
var _a;
|
|
2418
|
+
var _a, _b, _c;
|
|
2419
2419
|
if (context.packageManagerInfo.isClassic) {
|
|
2420
2420
|
return new BashExpression_1.BashExpression(`
|
|
2421
2421
|
RUN ${YARN_INSTALL_CLASSIC} --production --ignore-scripts
|
|
@@ -2423,11 +2423,14 @@ ${DOCKER_COPY_FILES}
|
|
|
2423
2423
|
RUN ${YARN_INSTALL_CLASSIC} --production
|
|
2424
2424
|
`.trim());
|
|
2425
2425
|
}
|
|
2426
|
+
const yarnRebuildEnabledDefault = context.build.type === "fromWorkspace"
|
|
2427
|
+
? ((_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true)
|
|
2428
|
+
: true;
|
|
2426
2429
|
const yarnRebuildEnabled = "docker" in context.build.config &&
|
|
2427
2430
|
context.build.config.docker &&
|
|
2428
2431
|
"yarnRebuildEnabled" in context.build.config.docker
|
|
2429
|
-
? ((
|
|
2430
|
-
:
|
|
2432
|
+
? ((_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault)
|
|
2433
|
+
: yarnRebuildEnabledDefault;
|
|
2431
2434
|
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
2432
2435
|
// trying to import those fail on this version
|
|
2433
2436
|
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) => context.packageManagerInfo.version.startsWith(v));
|
|
@@ -4211,6 +4214,7 @@ exports.ENV_VARS_FILENAME = "____envvars.yaml";
|
|
|
4211
4214
|
|
|
4212
4215
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4213
4216
|
exports.getOnDeployExecuteScript = void 0;
|
|
4217
|
+
const utils_1 = __nccwpck_require__(2497);
|
|
4214
4218
|
const createArgsString_1 = __nccwpck_require__(9598);
|
|
4215
4219
|
const getJobOrServiceArgs_1 = __nccwpck_require__(1741);
|
|
4216
4220
|
const jobName_1 = __nccwpck_require__(9626);
|
|
@@ -4220,7 +4224,7 @@ const getOnDeployExecuteScript = (context, when) => {
|
|
|
4220
4224
|
const executes = getExecutes(context);
|
|
4221
4225
|
return executes
|
|
4222
4226
|
.filter(({ config }) => config.when === when)
|
|
4223
|
-
.
|
|
4227
|
+
.flatMap((execute) => {
|
|
4224
4228
|
return getJobRunScriptForExecute(context, execute);
|
|
4225
4229
|
});
|
|
4226
4230
|
};
|
|
@@ -4231,7 +4235,8 @@ const getExecutes = (context) => {
|
|
|
4231
4235
|
return [
|
|
4232
4236
|
...getLegacyExecutes(context),
|
|
4233
4237
|
...Object.entries((_a = deployConfig.execute) !== null && _a !== void 0 ? _a : {}).flatMap(([key, value]) => {
|
|
4234
|
-
|
|
4238
|
+
// remove all schedule executes
|
|
4239
|
+
if (!value) {
|
|
4235
4240
|
return [];
|
|
4236
4241
|
}
|
|
4237
4242
|
return [
|
|
@@ -4269,21 +4274,30 @@ const getLegacyExecutes = (context) => {
|
|
|
4269
4274
|
};
|
|
4270
4275
|
const getJobRunScriptForExecute = (context, { jobName, config }) => {
|
|
4271
4276
|
var _a;
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4277
|
+
const type = config.type;
|
|
4278
|
+
if (type === "script") {
|
|
4279
|
+
return (0, utils_1.ensureArray)(config.script);
|
|
4280
|
+
}
|
|
4281
|
+
else if (type === "job") {
|
|
4282
|
+
const commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
|
|
4283
|
+
// always wait for completion for preStop and postStop jobs
|
|
4284
|
+
// since stop will delete the jobs afterwards, so they will fail
|
|
4285
|
+
const waitForCompletion = ["preStop", "postStop"].includes(config.when)
|
|
4286
|
+
? true // always
|
|
4287
|
+
: "waitForCompletion" in config
|
|
4288
|
+
? ((_a = config.waitForCompletion) !== null && _a !== void 0 ? _a : false) // depends on config
|
|
4289
|
+
: false;
|
|
4290
|
+
const argString = (0, createArgsString_1.createArgsString)({
|
|
4291
|
+
...commonArgs,
|
|
4292
|
+
wait: waitForCompletion === true ? true : undefined,
|
|
4293
|
+
args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args),
|
|
4294
|
+
});
|
|
4295
|
+
const fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
|
|
4296
|
+
return [
|
|
4297
|
+
`${(0, common_1.gcloudRunCmd)()} jobs execute ${fullJobName.toString()} ${argString}`,
|
|
4298
|
+
];
|
|
4299
|
+
}
|
|
4300
|
+
throw new Error(`unsupported execute type: ${type}`);
|
|
4287
4301
|
};
|
|
4288
4302
|
//# sourceMappingURL=onDeploy.js.map
|
|
4289
4303
|
|
|
@@ -5667,7 +5667,7 @@ const getYarnInstall = (context, options) => {
|
|
|
5667
5667
|
exports.getYarnInstall = getYarnInstall;
|
|
5668
5668
|
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
5669
5669
|
const getDockerAppCopyAndBuildScript = (context) => {
|
|
5670
|
-
var _a;
|
|
5670
|
+
var _a, _b, _c;
|
|
5671
5671
|
if (context.packageManagerInfo.isClassic) {
|
|
5672
5672
|
return new BashExpression_1.BashExpression(`
|
|
5673
5673
|
RUN ${YARN_INSTALL_CLASSIC} --production --ignore-scripts
|
|
@@ -5675,11 +5675,14 @@ ${DOCKER_COPY_FILES}
|
|
|
5675
5675
|
RUN ${YARN_INSTALL_CLASSIC} --production
|
|
5676
5676
|
`.trim());
|
|
5677
5677
|
}
|
|
5678
|
+
const yarnRebuildEnabledDefault = context.build.type === "fromWorkspace"
|
|
5679
|
+
? ((_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true)
|
|
5680
|
+
: true;
|
|
5678
5681
|
const yarnRebuildEnabled = "docker" in context.build.config &&
|
|
5679
5682
|
context.build.config.docker &&
|
|
5680
5683
|
"yarnRebuildEnabled" in context.build.config.docker
|
|
5681
|
-
? ((
|
|
5682
|
-
:
|
|
5684
|
+
? ((_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault)
|
|
5685
|
+
: yarnRebuildEnabledDefault;
|
|
5683
5686
|
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
5684
5687
|
// trying to import those fail on this version
|
|
5685
5688
|
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) => context.packageManagerInfo.version.startsWith(v));
|
|
@@ -7463,6 +7466,7 @@ exports.ENV_VARS_FILENAME = "____envvars.yaml";
|
|
|
7463
7466
|
|
|
7464
7467
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7465
7468
|
exports.getOnDeployExecuteScript = void 0;
|
|
7469
|
+
const utils_1 = __nccwpck_require__(32497);
|
|
7466
7470
|
const createArgsString_1 = __nccwpck_require__(49598);
|
|
7467
7471
|
const getJobOrServiceArgs_1 = __nccwpck_require__(61741);
|
|
7468
7472
|
const jobName_1 = __nccwpck_require__(9626);
|
|
@@ -7472,7 +7476,7 @@ const getOnDeployExecuteScript = (context, when) => {
|
|
|
7472
7476
|
const executes = getExecutes(context);
|
|
7473
7477
|
return executes
|
|
7474
7478
|
.filter(({ config }) => config.when === when)
|
|
7475
|
-
.
|
|
7479
|
+
.flatMap((execute) => {
|
|
7476
7480
|
return getJobRunScriptForExecute(context, execute);
|
|
7477
7481
|
});
|
|
7478
7482
|
};
|
|
@@ -7483,7 +7487,8 @@ const getExecutes = (context) => {
|
|
|
7483
7487
|
return [
|
|
7484
7488
|
...getLegacyExecutes(context),
|
|
7485
7489
|
...Object.entries((_a = deployConfig.execute) !== null && _a !== void 0 ? _a : {}).flatMap(([key, value]) => {
|
|
7486
|
-
|
|
7490
|
+
// remove all schedule executes
|
|
7491
|
+
if (!value) {
|
|
7487
7492
|
return [];
|
|
7488
7493
|
}
|
|
7489
7494
|
return [
|
|
@@ -7521,21 +7526,30 @@ const getLegacyExecutes = (context) => {
|
|
|
7521
7526
|
};
|
|
7522
7527
|
const getJobRunScriptForExecute = (context, { jobName, config }) => {
|
|
7523
7528
|
var _a;
|
|
7524
|
-
const
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
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}`);
|
|
7539
7553
|
};
|
|
7540
7554
|
//# sourceMappingURL=onDeploy.js.map
|
|
7541
7555
|
|
|
@@ -37,7 +37,7 @@ const getYarnInstall = (context, options) => {
|
|
|
37
37
|
exports.getYarnInstall = getYarnInstall;
|
|
38
38
|
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
39
39
|
const getDockerAppCopyAndBuildScript = (context) => {
|
|
40
|
-
var _a;
|
|
40
|
+
var _a, _b, _c;
|
|
41
41
|
if (context.packageManagerInfo.isClassic) {
|
|
42
42
|
return new BashExpression_1.BashExpression(`
|
|
43
43
|
RUN ${YARN_INSTALL_CLASSIC} --production --ignore-scripts
|
|
@@ -45,11 +45,14 @@ ${DOCKER_COPY_FILES}
|
|
|
45
45
|
RUN ${YARN_INSTALL_CLASSIC} --production
|
|
46
46
|
`.trim());
|
|
47
47
|
}
|
|
48
|
+
const yarnRebuildEnabledDefault = context.build.type === "fromWorkspace"
|
|
49
|
+
? ((_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true)
|
|
50
|
+
: true;
|
|
48
51
|
const yarnRebuildEnabled = "docker" in context.build.config &&
|
|
49
52
|
context.build.config.docker &&
|
|
50
53
|
"yarnRebuildEnabled" in context.build.config.docker
|
|
51
|
-
? ((
|
|
52
|
-
:
|
|
54
|
+
? ((_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault)
|
|
55
|
+
: yarnRebuildEnabledDefault;
|
|
53
56
|
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
54
57
|
// trying to import those fail on this version
|
|
55
58
|
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) => context.packageManagerInfo.version.startsWith(v));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/yarn.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAG3D,uCAA0C;AAC1C,+CAAyD;AAEzD,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAE9D,MAAM,uBAAuB,GAAG,oCAAoC,CAAC;AACrE,8CAA8C;AAC9C,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAE/C,MAAM,qBAAqB,GA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oBAAoB,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;QACjD,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,mCAC/C,yBAAyB,CAAC;QAC5B,CAAC,CAAC,yBAAyB,CAAC;IAEhC,wFAAwF;IACxF,8CAA8C;IAC9C,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1D,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CACjD,CAAC;IACF,MAAM,6BAA6B,GAAG,6BAA6B;QACjE,CAAC,CAAC,wCAAwC;QAC1C,CAAC,CAAC,EAAE,CAAC;IAEP,yCAAyC;IACzC,iGAAiG;IACjG,OAAO,IAAI,+BAAc,CACvB;;EAEF,iBAAiB;EACjB,6BAA6B;MACzB,uBAAuB;EAC3B,kBAAkB,CAAC,CAAC,CAAC,OAAO,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE;;KAEvD,CAAC,IAAI,EAAE,CACT,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,8BAA8B,kCAgDzC"}
|
|
@@ -348,6 +348,11 @@ export type WorkspaceBuildConfigBase = {
|
|
|
348
348
|
export type WorkspaceBuildConfigNode = {
|
|
349
349
|
type: "node";
|
|
350
350
|
buildCommand?: string | string[];
|
|
351
|
+
/**
|
|
352
|
+
* set docker config defaults for the node build type.
|
|
353
|
+
* Currently not all options are supported.
|
|
354
|
+
*/
|
|
355
|
+
dockerDefaults?: Pick<BuildConfigDockerBuiltInNode, "yarnRebuildEnabled">;
|
|
351
356
|
} & WorkspaceBuildConfigBase;
|
|
352
357
|
export type WorkspaceBuildConfig = WorkspaceBuildConfigNode;
|
|
353
358
|
export {};
|
|
@@ -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
|
-
.
|
|
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
|
-
|
|
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
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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":";;;
|
|
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,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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 @@
|
|
|
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
|
-
}
|
|
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 {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"googleCloudRun.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/types/googleCloudRun.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"googleCloudRun.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/types/googleCloudRun.ts"],"names":[],"mappings":";;;AA2Oa,QAAA,mBAAmB,GAA8B;IAC5D,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,WAAW;IAEjB,mBAAmB,EAAE,CAAC;IACtB,cAAc,EAAE,CAAC;IACjB,aAAa,EAAE,EAAE;IACjB,gBAAgB,EAAE,CAAC;CACpB,CAAC;AAEW,QAAA,oBAAoB,GAA8B;IAC7D,GAAG,2BAAmB;IAEtB,mBAAmB,EAAE,CAAC;IACtB,cAAc,EAAE,EAAE;IAClB,aAAa,EAAE,EAAE;IACjB,gBAAgB,EAAE,CAAC;CACpB,CAAC"}
|