@catladder/pipeline 3.42.0 → 3.43.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/testJob.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunWorkerPools.d.ts +4 -0
- package/dist/deploy/cloudRun/createJobs/cloudRunWorkerPools.js +92 -0
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +13 -2
- package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +12 -2
- package/dist/deploy/cloudRun/createJobs/volumes.d.ts +1 -1
- package/dist/deploy/types/googleCloudRun.d.ts +45 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/automatic-releases.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +10 -10
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +6 -6
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +4 -4
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +2 -2
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-worker-pool.test.ts.snap +1495 -0
- package/examples/__snapshots__/custom-deploy.test.ts.snap +2 -2
- package/examples/__snapshots__/custom-docker-file.test.ts.snap +2 -2
- package/examples/__snapshots__/custom-envs.test.ts.snap +4 -4
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +2 -2
- package/examples/__snapshots__/git-submodule.test.ts.snap +2 -2
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +2 -2
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +2 -2
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +4 -4
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +2 -2
- package/examples/__snapshots__/local-dot-env.test.ts.snap +2 -2
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +2 -2
- package/examples/__snapshots__/modify-generated-files.test.ts.snap +2 -2
- package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +2 -2
- package/examples/__snapshots__/multiline-var.test.ts.snap +6 -6
- package/examples/__snapshots__/native-app.test.ts.snap +4 -4
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +2 -2
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +2 -2
- package/examples/__snapshots__/override-secrets.test.ts.snap +2 -2
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +6 -6
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +4 -4
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +2 -2
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +2 -2
- package/examples/cloud-run-meteor-with-worker.ts +4 -5
- package/examples/cloud-run-with-worker.ts +5 -6
- package/examples/cloud-run-worker-pool.test.ts +12 -0
- package/examples/cloud-run-worker-pool.ts +42 -0
- package/package.json +1 -1
- package/src/build/node/testJob.ts +1 -1
- package/src/deploy/cloudRun/createJobs/cloudRunWorkerPools.ts +75 -0
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +14 -1
- package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +4 -0
- package/src/deploy/cloudRun/createJobs/volumes.ts +1 -1
- package/src/deploy/types/googleCloudRun.ts +55 -0
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ export const createNodeTestJobs = (
|
|
|
60
60
|
...(ensureArrayOrNull(buildConfig.audit?.command) ?? [
|
|
61
61
|
context.packageManagerInfo.isClassic
|
|
62
62
|
? "yarn audit --level critical"
|
|
63
|
-
: "yarn npm audit --environment production --
|
|
63
|
+
: "yarn npm audit --environment production --severity critical", // yarn 2
|
|
64
64
|
]),
|
|
65
65
|
],
|
|
66
66
|
allow_failure: buildConfig.audit?.allowFailure ?? true,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { getLabels } from "../../../context/getLabels";
|
|
2
|
+
import type { ComponentContext } from "../../../types/context";
|
|
3
|
+
|
|
4
|
+
import type { DeployConfigCloudRunWorkerPool } from "../../types/googleCloudRun";
|
|
5
|
+
import { createArgsString } from "../utils/createArgsString";
|
|
6
|
+
import { getCloudRunServiceOrJobArgsArg } from "../utils/getJobOrServiceArgs";
|
|
7
|
+
import { getServiceName } from "../utils/getServiceName";
|
|
8
|
+
import {
|
|
9
|
+
gcloudRunCmd,
|
|
10
|
+
getCommonCloudRunArgs,
|
|
11
|
+
getCommonDeployArgs,
|
|
12
|
+
makeLabelString,
|
|
13
|
+
} from "./common";
|
|
14
|
+
import { ENV_VARS_FILENAME } from "./constants";
|
|
15
|
+
import { createVolumeConfig } from "./volumes";
|
|
16
|
+
|
|
17
|
+
export const getWorkerPoolDeployScript = (
|
|
18
|
+
context: ComponentContext,
|
|
19
|
+
workerPool: DeployConfigCloudRunWorkerPool,
|
|
20
|
+
nameSuffix: string,
|
|
21
|
+
) => {
|
|
22
|
+
const commonDeployArgs = getCommonDeployArgs(context);
|
|
23
|
+
|
|
24
|
+
const serviceName = getServiceName(context);
|
|
25
|
+
|
|
26
|
+
const command = workerPool.command;
|
|
27
|
+
|
|
28
|
+
const commandArray = Array.isArray(command) ? command : command.split(" ");
|
|
29
|
+
|
|
30
|
+
const fullWorkerPoolName = `${serviceName}-${nameSuffix}`;
|
|
31
|
+
|
|
32
|
+
const argsString = createArgsString(
|
|
33
|
+
{
|
|
34
|
+
command: '"' + commandArray.join(",") + '"',
|
|
35
|
+
args: getCloudRunServiceOrJobArgsArg(workerPool.args),
|
|
36
|
+
...commonDeployArgs,
|
|
37
|
+
image: workerPool.image ?? commonDeployArgs.image,
|
|
38
|
+
labels: makeLabelString({
|
|
39
|
+
...getLabels(context),
|
|
40
|
+
"cloud-run-worker-pool-name": fullWorkerPoolName,
|
|
41
|
+
}),
|
|
42
|
+
"env-vars-file": ENV_VARS_FILENAME,
|
|
43
|
+
instances: workerPool.instances ?? 1,
|
|
44
|
+
cpu: workerPool.cpu ?? 1,
|
|
45
|
+
memory: workerPool.memory ?? "512Mi",
|
|
46
|
+
"vpc-connector": workerPool.vpcConnector,
|
|
47
|
+
"vpc-egress": workerPool.vpcEgress,
|
|
48
|
+
network: workerPool.network,
|
|
49
|
+
subnet: workerPool.subnet,
|
|
50
|
+
gpu: workerPool.gpu,
|
|
51
|
+
"gpu-type": workerPool.gpuType,
|
|
52
|
+
},
|
|
53
|
+
...createVolumeConfig(workerPool.volumes, "worker-pool"),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Worker pools are in beta and require the beta command
|
|
57
|
+
return `${gcloudRunCmd("beta")} worker-pools deploy ${fullWorkerPoolName} ${argsString}`;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const getWorkerPoolDeleteScript = (
|
|
61
|
+
context: ComponentContext,
|
|
62
|
+
workerPoolSuffix: string,
|
|
63
|
+
) => {
|
|
64
|
+
const commonArgs = getCommonCloudRunArgs(context);
|
|
65
|
+
|
|
66
|
+
const commonArgsString = createArgsString(commonArgs);
|
|
67
|
+
|
|
68
|
+
const serviceName = getServiceName(context);
|
|
69
|
+
|
|
70
|
+
const fullWorkerPoolName = `${serviceName}-${workerPoolSuffix}`;
|
|
71
|
+
|
|
72
|
+
return [
|
|
73
|
+
`${gcloudRunCmd("beta")} worker-pools delete ${fullWorkerPoolName} ${commonArgsString}`,
|
|
74
|
+
];
|
|
75
|
+
};
|
|
@@ -10,13 +10,17 @@ import { gcloudServiceAccountLoginCommands } from "../utils/gcloudServiceAccount
|
|
|
10
10
|
import { getJobCreateScripts } from "./cloudRunJobs";
|
|
11
11
|
import { getOnDeployExecuteScript } from "./execute/onDeploy";
|
|
12
12
|
import { getServiceDeployScript } from "./cloudRunServices";
|
|
13
|
+
import { getWorkerPoolDeployScript } from "./cloudRunWorkerPools";
|
|
13
14
|
import {
|
|
14
15
|
getCloudRunDeployConfig,
|
|
15
16
|
setGoogleProjectNumberScript,
|
|
16
17
|
} from "./common";
|
|
17
18
|
import { ENV_VARS_FILENAME } from "./constants";
|
|
18
19
|
import { getCreateScheduleScript } from "./execute/schedules";
|
|
19
|
-
import type {
|
|
20
|
+
import type {
|
|
21
|
+
DeployConfigCloudRunService,
|
|
22
|
+
DeployConfigCloudRunWorkerPool,
|
|
23
|
+
} from "../../types";
|
|
20
24
|
|
|
21
25
|
export function getCloudRunDeployScripts(context: ComponentContext) {
|
|
22
26
|
const deployConfig = getCloudRunDeployConfig(context);
|
|
@@ -61,6 +65,15 @@ export function getCloudRunDeployScripts(context: ComponentContext) {
|
|
|
61
65
|
"-" + name,
|
|
62
66
|
),
|
|
63
67
|
),
|
|
68
|
+
...Object.entries(deployConfig.workerPools ?? {})
|
|
69
|
+
.filter(([_, workerPool]) => workerPool !== false && workerPool !== null)
|
|
70
|
+
.map(([name, workerPool]) =>
|
|
71
|
+
getWorkerPoolDeployScript(
|
|
72
|
+
context,
|
|
73
|
+
workerPool as DeployConfigCloudRunWorkerPool,
|
|
74
|
+
name,
|
|
75
|
+
),
|
|
76
|
+
),
|
|
64
77
|
...getOnDeployExecuteScript(context, "postDeploy"),
|
|
65
78
|
]),
|
|
66
79
|
...collapseableSection(
|
|
@@ -7,6 +7,7 @@ import { getDeleteJobsScripts } from "./cloudRunJobs";
|
|
|
7
7
|
import { getOnDeployExecuteScript } from "./execute/onDeploy";
|
|
8
8
|
import { getDeleteSchedulesScript } from "./execute/schedules";
|
|
9
9
|
import { getServiceDeleteScript } from "./cloudRunServices";
|
|
10
|
+
import { getWorkerPoolDeleteScript } from "./cloudRunWorkerPools";
|
|
10
11
|
import { getCloudRunDeployConfig } from "./common";
|
|
11
12
|
|
|
12
13
|
export function getCloudRunStopScripts(context: ComponentContext) {
|
|
@@ -18,6 +19,9 @@ export function getCloudRunStopScripts(context: ComponentContext) {
|
|
|
18
19
|
...Object.entries(deployConfig.additionalServices ?? {})
|
|
19
20
|
.filter(([_, service]) => service !== false && service !== null)
|
|
20
21
|
.flatMap(([name]) => getServiceDeleteScript(context, name)),
|
|
22
|
+
...Object.entries(deployConfig.workerPools ?? {})
|
|
23
|
+
.filter(([_, workerPool]) => workerPool !== false && workerPool !== null)
|
|
24
|
+
.flatMap(([name]) => getWorkerPoolDeleteScript(context, name)),
|
|
21
25
|
...getOnDeployExecuteScript(context, "postStop"),
|
|
22
26
|
...getDeleteSchedulesScript(context),
|
|
23
27
|
...getDeleteJobsScripts(context),
|
|
@@ -3,7 +3,7 @@ import type { keyValuesArg } from "../utils/createArgsString";
|
|
|
3
3
|
|
|
4
4
|
export const createVolumeConfig = (
|
|
5
5
|
volumes: DeployConfigCloudRunVolumes | undefined,
|
|
6
|
-
type: "service" | "job",
|
|
6
|
+
type: "service" | "job" | "worker-pool",
|
|
7
7
|
): keyValuesArg[] => {
|
|
8
8
|
if (!volumes) {
|
|
9
9
|
return [];
|
|
@@ -436,6 +436,52 @@ export type DeployConfigCloudRunJob =
|
|
|
436
436
|
| DeployConfigCloudRunJobNormal
|
|
437
437
|
| DeployConfigCloudRunJobWithSchedule;
|
|
438
438
|
|
|
439
|
+
export type DeployConfigCloudRunWorkerPool = {
|
|
440
|
+
/**
|
|
441
|
+
* command / entrypoint for the worker pool
|
|
442
|
+
*/
|
|
443
|
+
command: string | string[];
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* number of instances to run. Defaults to 1.
|
|
447
|
+
* Worker pools do not support autoscaling.
|
|
448
|
+
*/
|
|
449
|
+
instances?: number;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* CPU limit. Defaults to 1
|
|
453
|
+
*/
|
|
454
|
+
cpu?: Cpu;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* memory limit. Defaults to 512Mi
|
|
458
|
+
*/
|
|
459
|
+
memory?: Memory;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* the image to use. Defaults to the image from the build.
|
|
463
|
+
*/
|
|
464
|
+
image?: string;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* args to pass to the command
|
|
468
|
+
*/
|
|
469
|
+
args?: string[];
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Number of GPUs to use. Defaults to 0
|
|
473
|
+
*
|
|
474
|
+
* This is a preview feature and not all regions support it.
|
|
475
|
+
*/
|
|
476
|
+
gpu?: number;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* gpu type to use. Refer to https://cloud.google.com/run/docs/configuring/services/gpu#gcloud for defaults
|
|
480
|
+
*/
|
|
481
|
+
gpuType?: string;
|
|
482
|
+
} & DeployConfigCloudRunWithVolumes &
|
|
483
|
+
DeployConfigCloudRunNetworkConfig;
|
|
484
|
+
|
|
439
485
|
export type DeployConfigCloudRun = Omit<DeployConfigBase, "execute"> & {
|
|
440
486
|
/**
|
|
441
487
|
* cloud run deployment.
|
|
@@ -470,6 +516,15 @@ export type DeployConfigCloudRun = Omit<DeployConfigBase, "execute"> & {
|
|
|
470
516
|
[name: string]: DeployConfigCloudRunJob | false | null;
|
|
471
517
|
};
|
|
472
518
|
|
|
519
|
+
/**
|
|
520
|
+
* deploy worker pools for continuous background work.
|
|
521
|
+
* Worker pools are cost-effective alternatives to services for background processing.
|
|
522
|
+
* They don't have a load balanced endpoint and don't support autoscaling.
|
|
523
|
+
*/
|
|
524
|
+
workerPools?: {
|
|
525
|
+
[name: string]: DeployConfigCloudRunWorkerPool | false | null;
|
|
526
|
+
};
|
|
527
|
+
|
|
473
528
|
/**
|
|
474
529
|
* add cloudSql
|
|
475
530
|
*/
|