@catladder/pipeline 3.28.0 → 3.30.0
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/build/node/yarn.js +3 -2
- package/dist/build/types.d.ts +5 -0
- package/dist/constants.js +1 -1
- package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +22 -14
- package/dist/deploy/types/executeBase.d.ts +24 -0
- package/dist/deploy/types/executeBase.js +5 -0
- package/dist/deploy/types/googleCloudRun.d.ts +5 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +1618 -0
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +8 -16
- package/examples/cloud-run-execute-script-on-deploy.test.ts +11 -0
- package/examples/cloud-run-execute-script-on-deploy.ts +47 -0
- package/examples/workspace-api-www.ts +3 -0
- package/package.json +1 -1
- package/src/build/node/yarn.ts +9 -2
- package/src/build/types.ts +5 -0
- package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +31 -24
- package/src/deploy/types/base.ts +1 -0
- package/src/deploy/types/executeBase.ts +27 -0
- package/src/deploy/types/googleCloudRun.ts +8 -2
package/dist/build/node/yarn.js
CHANGED
|
@@ -60,11 +60,12 @@ var getYarnInstall = function (context, options) {
|
|
|
60
60
|
exports.getYarnInstall = getYarnInstall;
|
|
61
61
|
var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
|
|
62
62
|
var getDockerAppCopyAndBuildScript = function (context) {
|
|
63
|
-
var _a;
|
|
63
|
+
var _a, _b, _c;
|
|
64
64
|
if (context.packageManagerInfo.isClassic) {
|
|
65
65
|
return new BashExpression_1.BashExpression("\nRUN ".concat(YARN_INSTALL_CLASSIC, " --production --ignore-scripts\n").concat(DOCKER_COPY_FILES, "\nRUN ").concat(YARN_INSTALL_CLASSIC, " --production \n ").trim());
|
|
66
66
|
}
|
|
67
|
-
var
|
|
67
|
+
var yarnRebuildEnabledDefault = context.build.type === "fromWorkspace" ? (_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true : true;
|
|
68
|
+
var yarnRebuildEnabled = "docker" in context.build.config && context.build.config.docker && "yarnRebuildEnabled" in context.build.config.docker ? (_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault : yarnRebuildEnabledDefault;
|
|
68
69
|
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
69
70
|
// trying to import those fail on this version
|
|
70
71
|
var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
|
package/dist/build/types.d.ts
CHANGED
|
@@ -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 {};
|
package/dist/constants.js
CHANGED
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
7
|
-
exports.PIPELINE_IMAGE_TAG = "v3-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "v3-30-0-134740e2" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -45,6 +45,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
45
45
|
value: true
|
|
46
46
|
});
|
|
47
47
|
exports.getOnDeployExecuteScript = void 0;
|
|
48
|
+
var utils_1 = require("../../../../utils");
|
|
48
49
|
var createArgsString_1 = require("../../utils/createArgsString");
|
|
49
50
|
var getJobOrServiceArgs_1 = require("../../utils/getJobOrServiceArgs");
|
|
50
51
|
var jobName_1 = require("../../utils/jobName");
|
|
@@ -55,7 +56,7 @@ var getOnDeployExecuteScript = function (context, when) {
|
|
|
55
56
|
return executes.filter(function (_a) {
|
|
56
57
|
var config = _a.config;
|
|
57
58
|
return config.when === when;
|
|
58
|
-
}).
|
|
59
|
+
}).flatMap(function (execute) {
|
|
59
60
|
return getJobRunScriptForExecute(context, execute);
|
|
60
61
|
});
|
|
61
62
|
};
|
|
@@ -67,7 +68,8 @@ var getExecutes = function (context) {
|
|
|
67
68
|
var _b = __read(_a, 2),
|
|
68
69
|
key = _b[0],
|
|
69
70
|
value = _b[1];
|
|
70
|
-
|
|
71
|
+
// remove all schedule executes
|
|
72
|
+
if (!value) {
|
|
71
73
|
return [];
|
|
72
74
|
}
|
|
73
75
|
return [{
|
|
@@ -100,16 +102,22 @@ var getJobRunScriptForExecute = function (context, _a) {
|
|
|
100
102
|
var _b;
|
|
101
103
|
var jobName = _a.jobName,
|
|
102
104
|
config = _a.config;
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
var type = config.type;
|
|
106
|
+
if (type === "script") {
|
|
107
|
+
return (0, utils_1.ensureArray)(config.script);
|
|
108
|
+
} else if (type === "job") {
|
|
109
|
+
var commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
|
|
110
|
+
// always wait for completion for preStop and postStop jobs
|
|
111
|
+
// since stop will delete the jobs afterwards, so they will fail
|
|
112
|
+
var waitForCompletion = ["preStop", "postStop"].includes(config.when) ? true // always
|
|
113
|
+
: "waitForCompletion" in config ? (_b = config.waitForCompletion) !== null && _b !== void 0 ? _b : false // depends on config
|
|
114
|
+
: false;
|
|
115
|
+
var argString = (0, createArgsString_1.createArgsString)(__assign(__assign({}, commonArgs), {
|
|
116
|
+
wait: waitForCompletion === true ? true : undefined,
|
|
117
|
+
args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args)
|
|
118
|
+
}));
|
|
119
|
+
var fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
|
|
120
|
+
return ["".concat((0, common_1.gcloudRunCmd)(), " jobs execute ").concat(fullJobName.toString(), " ").concat(argString)];
|
|
121
|
+
}
|
|
122
|
+
throw new Error("unsupported execute type: ".concat(type));
|
|
115
123
|
};
|
|
@@ -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 {};
|
|
@@ -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 {};
|