@catladder/pipeline 0.0.0-node16-ddfae617 → 0.0.0-refactor-env-context-9e652b63
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/bin/catladder-gitlab.js +1 -1
- package/dist/build/base/createBuildJob.d.ts +2 -2
- package/dist/build/base/getBuildInfo.d.ts +1 -1
- package/dist/build/docker.d.ts +44 -6
- package/dist/build/docker.js +45 -19
- package/dist/build/index.d.ts +6 -5
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/cache.d.ts +2 -2
- package/dist/build/node/index.d.ts +1 -1
- package/dist/build/node/meteor.d.ts +1 -1
- package/dist/build/node/meteor.js +6 -0
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +3 -0
- package/dist/build/node/yarn.d.ts +1 -1
- package/dist/build/node/yarn.js +13 -1
- package/dist/build/types.d.ts +10 -0
- package/dist/bundles/catladder-gitlab/index.js +32457 -0
- package/dist/catladder-gitlab.js +1 -2
- package/dist/config/configruedEnvs.d.ts +1 -1
- package/dist/config/readConfig.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/context/getEnvConfig.d.ts +9 -0
- package/dist/context/getEnvConfig.js +26 -0
- package/dist/context/getEnvType.d.ts +4 -0
- package/dist/context/getEnvType.js +18 -0
- package/dist/context/getEnvironment.d.ts +3 -0
- package/dist/context/getEnvironment.js +187 -0
- package/dist/context/getEnvironmentContext.d.ts +4 -0
- package/dist/context/getEnvironmentContext.js +36 -0
- package/dist/context/getEnvironmentVariables.d.ts +10 -0
- package/dist/context/getEnvironmentVariables.js +322 -0
- package/dist/context/getLabels.d.ts +8 -0
- package/dist/context/getLabels.js +49 -0
- package/dist/context/index.d.ts +5 -6
- package/dist/context/index.js +176 -181
- package/dist/context/resolveReferences.d.ts +1 -3
- package/dist/context/resolveReferences.js +275 -26
- package/dist/context/resolveReferences.test.js +332 -81
- package/dist/defaults/index.d.ts +1 -1
- package/dist/deploy/base.d.ts +4 -2
- package/dist/deploy/base.js +37 -17
- package/dist/deploy/cloudRun/deployJob.d.ts +3 -0
- package/dist/deploy/cloudRun/deployJob.js +139 -0
- package/dist/deploy/cloudRun/index.d.ts +9 -0
- package/dist/deploy/cloudRun/index.js +56 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +14 -0
- package/dist/deploy/cloudSql/index.d.ts +8 -0
- package/dist/deploy/cloudSql/index.js +30 -0
- package/dist/deploy/custom/deployJob.d.ts +2 -2
- package/dist/deploy/custom/deployJob.js +4 -1
- package/dist/deploy/custom/index.d.ts +2 -1
- package/dist/deploy/custom/index.js +15 -18
- package/dist/deploy/dockerTag/deployJob.d.ts +3 -0
- package/dist/deploy/dockerTag/deployJob.js +33 -0
- package/dist/deploy/dockerTag/index.d.ts +2 -0
- package/dist/deploy/dockerTag/index.js +19 -0
- package/dist/deploy/index.d.ts +12 -8
- package/dist/deploy/index.js +27 -14
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +4 -0
- package/dist/deploy/kubernetes/additionalSecretKeys.js +33 -0
- package/dist/deploy/kubernetes/cloudsql.d.ts +1 -1
- package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/deploy/kubernetes/deployJob.js +13 -66
- package/dist/deploy/kubernetes/index.d.ts +2 -1
- package/dist/deploy/kubernetes/index.js +45 -16
- package/dist/deploy/kubernetes/kubeEnv.d.ts +10 -0
- package/dist/deploy/kubernetes/kubeEnv.js +90 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +90 -0
- package/dist/deploy/kubernetes/kubeValues.js +96 -0
- package/dist/deploy/kubernetes/mongodb.d.ts +18 -5
- package/dist/deploy/kubernetes/mongodb.js +118 -8
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +21 -21
- package/dist/deploy/types/base.d.ts +15 -0
- package/dist/deploy/types/base.js +3 -0
- package/dist/deploy/types/custom.d.ts +27 -0
- package/dist/deploy/types/custom.js +3 -0
- package/dist/deploy/types/dockerTag.d.ts +10 -0
- package/dist/deploy/types/dockerTag.js +3 -0
- package/dist/deploy/types/googleCloudRun.d.ts +39 -0
- package/dist/deploy/types/googleCloudRun.js +3 -0
- package/dist/deploy/types/index.d.ts +24 -0
- package/dist/deploy/types/index.js +41 -0
- package/dist/deploy/{types.d.ts → types/kubernetes.d.ts} +128 -36
- package/dist/deploy/types/kubernetes.js +3 -0
- package/dist/deploy/utils.d.ts +2 -2
- package/dist/deploy/utils.js +4 -0
- package/dist/pipeline/createChildPipeline.d.ts +2 -2
- package/dist/pipeline/createChildPipeline.js +3 -3
- package/dist/pipeline/createJobs.d.ts +2 -2
- package/dist/pipeline/createJobs.js +63 -25
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +3 -2
- package/dist/pipeline/gitlab/makeGitlabJob.js +2 -1
- package/dist/pipeline/packageManager.d.ts +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/runner/index.d.ts +2 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +7 -6
- package/dist/types/config.js +1 -1
- package/dist/types/context.d.ts +10 -2
- package/dist/types/environmentContext.d.ts +22 -0
- package/dist/types/environmentContext.js +3 -0
- package/dist/types/gitlab-types.d.ts +1 -1
- package/dist/types/jobs.d.ts +8 -3
- package/dist/types/jobs.js +1 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/package.json +15 -11
- package/scripts/bundle +2 -0
- package/src/build/base/createBuildJob.ts +3 -2
- package/src/build/base/getBuildInfo.ts +1 -1
- package/src/build/docker.ts +47 -29
- package/src/build/index.ts +8 -5
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +2 -2
- package/src/build/node/index.ts +1 -1
- package/src/build/node/meteor.ts +8 -2
- package/src/build/node/testJob.ts +4 -2
- package/src/build/node/yarn.ts +21 -10
- package/src/build/tests/storybook.test.ts +1 -1
- package/src/build/types.ts +13 -1
- package/src/catladder-gitlab.ts +4 -2
- package/src/config/configruedEnvs.test.ts +2 -2
- package/src/config/configruedEnvs.ts +5 -4
- package/src/config/readConfig.ts +1 -1
- package/src/context/getEnvConfig.ts +21 -0
- package/src/context/getEnvType.ts +17 -0
- package/src/context/getEnvironment.ts +40 -0
- package/src/context/getEnvironmentContext.ts +57 -0
- package/src/context/getEnvironmentVariables.ts +152 -0
- package/src/context/getLabels.ts +20 -0
- package/src/context/index.ts +25 -191
- package/src/context/resolveReferences.test.ts +15 -15
- package/src/context/resolveReferences.ts +37 -30
- package/src/defaults/index.ts +1 -1
- package/src/deploy/base.ts +43 -19
- package/src/deploy/cloudRun/deployJob.ts +104 -0
- package/src/deploy/cloudRun/index.ts +48 -0
- package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +14 -0
- package/src/deploy/cloudSql/index.ts +16 -0
- package/src/deploy/custom/deployJob.ts +10 -3
- package/src/deploy/custom/index.ts +9 -1
- package/src/deploy/dockerTag/deployJob.ts +31 -0
- package/src/deploy/dockerTag/index.ts +9 -0
- package/src/deploy/index.ts +26 -17
- package/src/deploy/kubernetes/additionalSecretKeys.ts +23 -0
- package/src/deploy/kubernetes/cloudsql.ts +2 -1
- package/src/deploy/kubernetes/deployJob.ts +19 -77
- package/src/deploy/kubernetes/index.ts +42 -1
- package/src/deploy/kubernetes/kubeEnv.ts +48 -0
- package/src/deploy/kubernetes/kubeValues.ts +82 -0
- package/src/deploy/kubernetes/mongodb.ts +104 -7
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +1 -1
- package/src/deploy/types/base.ts +17 -0
- package/src/deploy/types/custom.ts +24 -0
- package/src/deploy/types/dockerTag.ts +12 -0
- package/src/deploy/types/googleCloudRun.ts +79 -0
- package/src/deploy/types/index.ts +28 -0
- package/src/deploy/types/kubernetes.ts +281 -0
- package/src/deploy/utils.ts +6 -2
- package/src/pipeline/createChildPipeline.test.ts +1 -1
- package/src/pipeline/createChildPipeline.ts +4 -4
- package/src/pipeline/createJobs.ts +32 -21
- package/src/pipeline/gitlab/makeGitlabJob.ts +3 -2
- package/src/pipeline/packageManager.ts +1 -1
- package/src/rules/index.ts +1 -1
- package/src/runner/index.ts +2 -1
- package/src/types/config.ts +8 -6
- package/src/types/context.ts +14 -2
- package/src/types/environmentContext.ts +26 -0
- package/src/types/gitlab-types.ts +1 -1
- package/src/types/jobs.ts +9 -2
- package/src/types/pipeline.ts +1 -1
- package/tsconfig.json +2 -0
- package/dist/deploy/types.js +0 -16
- package/src/deploy/types.ts +0 -189
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DeployConfigBase } from "./base";
|
|
2
|
+
export declare 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";
|
|
3
|
+
export declare type DeployConfigCloudRunBase = {
|
|
4
|
+
/**
|
|
5
|
+
* the google cloud porject id
|
|
6
|
+
*/
|
|
7
|
+
projectId: string;
|
|
8
|
+
/**
|
|
9
|
+
* the region. Set to europe-west6 for switzerland
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
region: Gcloudregion;
|
|
13
|
+
/**
|
|
14
|
+
* command / entrypoint, fallsback to buildConfig.startcommand
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
command?: string;
|
|
18
|
+
} & DeployConfigBase;
|
|
19
|
+
export declare type DeployConfigCloudRunService = {
|
|
20
|
+
/**
|
|
21
|
+
* EXPERIMENTAL cloud run deployment.
|
|
22
|
+
*
|
|
23
|
+
* This will deploy a cloud run service.
|
|
24
|
+
*
|
|
25
|
+
* Requires that cloud run is enabled on the project, as well as cloud run api and artifacts registry.
|
|
26
|
+
*/
|
|
27
|
+
type: "google-cloudrun";
|
|
28
|
+
} & DeployConfigCloudRunBase;
|
|
29
|
+
export declare type DeployConfigCloudRunJob = {
|
|
30
|
+
/**
|
|
31
|
+
* EXPERIMENTAL cloud run job.
|
|
32
|
+
*
|
|
33
|
+
* This will deploy a cloud run job. This does not do much currently, but will be later used for cronjobs
|
|
34
|
+
*
|
|
35
|
+
* Requires that cloud run is enabled on the project, as well as cloud run api and artifacts registry.
|
|
36
|
+
*/
|
|
37
|
+
type: "google-cloudrun-job";
|
|
38
|
+
} & DeployConfigCloudRunBase;
|
|
39
|
+
export declare type DeployConfigCloudRun = DeployConfigCloudRunService | DeployConfigCloudRunJob;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DeployConfigCustom } from "./custom";
|
|
2
|
+
import type { DeployConfigDockerTag } from "./dockerTag";
|
|
3
|
+
import type { DeployConfigCloudRun } from "./googleCloudRun";
|
|
4
|
+
import type { DeployConfigKubernetes } from "./kubernetes";
|
|
5
|
+
export * from "./custom";
|
|
6
|
+
export * from "./googleCloudRun";
|
|
7
|
+
export * from "./kubernetes";
|
|
8
|
+
export * from "./dockerTag";
|
|
9
|
+
export declare type DeployConfig = DeployConfigKubernetes | DeployConfigCustom | DeployConfigCloudRun | DeployConfigDockerTag;
|
|
10
|
+
export declare type DeployConfigType = DeployConfig["type"];
|
|
11
|
+
export declare type DeployConfigGeneric<T extends DeployConfigType> = Extract<DeployConfig, {
|
|
12
|
+
type: T;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const isOfDeployType: <T extends ("custom" | "dockerTag" | "google-cloudrun" | "google-cloudrun-job" | "kubernetes")[]>(t: DeployConfig | false, ...types: T) => t is Extract<DeployConfigCustom, {
|
|
15
|
+
type: T[number];
|
|
16
|
+
}> | Extract<DeployConfigDockerTag, {
|
|
17
|
+
type: T[number];
|
|
18
|
+
}> | Extract<import("./googleCloudRun").DeployConfigCloudRunService, {
|
|
19
|
+
type: T[number];
|
|
20
|
+
}> | Extract<import("./googleCloudRun").DeployConfigCloudRunJob, {
|
|
21
|
+
type: T[number];
|
|
22
|
+
}> | Extract<DeployConfigKubernetes, {
|
|
23
|
+
type: T[number];
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
Object.defineProperty(o, k2, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
8
|
+
return m[k];
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
} : function (o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.__esModule = true;
|
|
21
|
+
exports.isOfDeployType = void 0;
|
|
22
|
+
|
|
23
|
+
__exportStar(require("./custom"), exports);
|
|
24
|
+
|
|
25
|
+
__exportStar(require("./googleCloudRun"), exports);
|
|
26
|
+
|
|
27
|
+
__exportStar(require("./kubernetes"), exports);
|
|
28
|
+
|
|
29
|
+
__exportStar(require("./dockerTag"), exports);
|
|
30
|
+
|
|
31
|
+
var isOfDeployType = function (t) {
|
|
32
|
+
var types = [];
|
|
33
|
+
|
|
34
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
35
|
+
types[_i - 1] = arguments[_i];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return t && types.includes(t.type);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.isOfDeployType = isOfDeployType;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* whether to deploy automatically or manual. If not defined, these rules apply:
|
|
4
|
-
* - prod: manual
|
|
5
|
-
* - all other envs: auto
|
|
6
|
-
*/
|
|
7
|
-
when?: "manual" | "auto";
|
|
8
|
-
};
|
|
9
|
-
declare type AllowUnknownProps<T extends Record<string, unknown>> = T & Record<string, unknown>;
|
|
1
|
+
import type { AllowUnknownProps, DeployConfigBase } from "./base";
|
|
10
2
|
export declare type DeployConfigKubernetesClusterGCloud = {
|
|
11
3
|
type: "gcloud";
|
|
12
4
|
/**
|
|
@@ -54,6 +46,16 @@ export declare type KubernetesAutoscale = {
|
|
|
54
46
|
|
|
55
47
|
metrics: KubernetesAutoscaleMetric[];
|
|
56
48
|
};
|
|
49
|
+
export declare type KubernetesResourcesDef = {
|
|
50
|
+
limits?: {
|
|
51
|
+
cpu?: string;
|
|
52
|
+
memory?: string;
|
|
53
|
+
};
|
|
54
|
+
requests?: {
|
|
55
|
+
cpu?: string;
|
|
56
|
+
memory?: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
57
59
|
declare type KubernetesHealthDef = {
|
|
58
60
|
httpGet?: {
|
|
59
61
|
path?: string;
|
|
@@ -68,6 +70,63 @@ declare type KubernetesHealthDef = {
|
|
|
68
70
|
successThreshold?: number;
|
|
69
71
|
};
|
|
70
72
|
};
|
|
73
|
+
export declare type KubernetesUpdateStrategy = {
|
|
74
|
+
rollingUpdate: {
|
|
75
|
+
/**
|
|
76
|
+
* how many pods can be created additionally to the target number
|
|
77
|
+
* can be absolute number or percentage.
|
|
78
|
+
* defaults to 1 (kube default is 25%)
|
|
79
|
+
*/
|
|
80
|
+
maxSurge: number | string;
|
|
81
|
+
/**
|
|
82
|
+
* how many pods are allowed to be unavailable
|
|
83
|
+
* can be absolute number or percentage
|
|
84
|
+
* defaults to 0 (kube default is 25%)
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
maxUnavailable: number | string;
|
|
88
|
+
};
|
|
89
|
+
type: "RollingUpdate";
|
|
90
|
+
};
|
|
91
|
+
export declare type KubernetesWorkerDef = {
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* which command to run. defaults to `yarn start`
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
command?: string;
|
|
98
|
+
resources?: KubernetesResourcesDef;
|
|
99
|
+
service?: {
|
|
100
|
+
enabled?: boolean;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export declare type DeployConfigMongodbBase = {
|
|
104
|
+
enabled?: boolean;
|
|
105
|
+
dbName?: string;
|
|
106
|
+
persistence?: {
|
|
107
|
+
/**
|
|
108
|
+
* set premium-rwo for ssd
|
|
109
|
+
*/
|
|
110
|
+
storageClass?: "standard-rwo" | "premium-rwo";
|
|
111
|
+
/**
|
|
112
|
+
* size of the volume, defaults to 8Gi
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
size?: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export declare type DeployConfigMongodbStandalone = {
|
|
119
|
+
architecture: "standalone";
|
|
120
|
+
};
|
|
121
|
+
export declare type DeployConfigMongodbReplicaset = {
|
|
122
|
+
architecture: "replicaset";
|
|
123
|
+
/**
|
|
124
|
+
* defaults to 2
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
replicaCount?: number;
|
|
128
|
+
};
|
|
129
|
+
export declare type DeployConfigMongodb = DeployConfigMongodbBase & (DeployConfigMongodbStandalone | DeployConfigMongodbReplicaset);
|
|
71
130
|
export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
72
131
|
/**
|
|
73
132
|
* enable cloudsql db. Currently you have to manually set it up
|
|
@@ -80,12 +139,10 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
80
139
|
};
|
|
81
140
|
/**
|
|
82
141
|
* enable mongodb. The mongodb is deployed using a helm chart.
|
|
83
|
-
*
|
|
142
|
+
* See https://github.com/bitnami/charts/tree/master/bitnami/mongodb
|
|
84
143
|
*/
|
|
85
144
|
|
|
86
|
-
mongodb?:
|
|
87
|
-
enabled: boolean;
|
|
88
|
-
}>;
|
|
145
|
+
mongodb?: DeployConfigMongodb;
|
|
89
146
|
/**
|
|
90
147
|
* enable mailhog. Mailhog is a virtual mail server that catches all outgoing mailsl and show them in a mailbox.
|
|
91
148
|
* This is great for development as it prevents to accidentially send out real emails and helps with debugging outgoing mails.
|
|
@@ -104,7 +161,17 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
104
161
|
*/
|
|
105
162
|
|
|
106
163
|
jobs?: Record<string, AllowUnknownProps<{
|
|
164
|
+
/**
|
|
165
|
+
* the command to execute
|
|
166
|
+
*/
|
|
107
167
|
command: string;
|
|
168
|
+
/**
|
|
169
|
+
* comma-separated list of helm hooks, see https://helm.sh/docs/topics/charts_hooks/
|
|
170
|
+
*
|
|
171
|
+
* defaults to post-install,post-upgrade
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
hook?: string;
|
|
108
175
|
}>>;
|
|
109
176
|
/**
|
|
110
177
|
* cronjobs that run periodically. These use the app image have all env vars available.
|
|
@@ -119,13 +186,23 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
119
186
|
* configuration for the application ("Deployment" in kubernetes)
|
|
120
187
|
*/
|
|
121
188
|
|
|
122
|
-
application?: AllowUnknownProps<{
|
|
189
|
+
application?: false | AllowUnknownProps<{
|
|
190
|
+
/**
|
|
191
|
+
* enable, disable app deployment, defaults to true
|
|
192
|
+
*/
|
|
193
|
+
enabled?: boolean;
|
|
123
194
|
/**
|
|
124
195
|
* redirects
|
|
125
196
|
*/
|
|
197
|
+
|
|
126
198
|
redirects?: AllowUnknownProps<{
|
|
127
199
|
host: string;
|
|
128
200
|
}>[];
|
|
201
|
+
/**
|
|
202
|
+
* Host aliases
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
hostAliases?: string[];
|
|
129
206
|
/**
|
|
130
207
|
* how many pods will be started
|
|
131
208
|
*/
|
|
@@ -136,28 +213,55 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
136
213
|
*/
|
|
137
214
|
|
|
138
215
|
autoscale?: KubernetesAutoscale;
|
|
216
|
+
/**
|
|
217
|
+
* the update strategy, see https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-update-deployment
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
updateStrategy?: KubernetesUpdateStrategy;
|
|
139
221
|
/**
|
|
140
222
|
* kubernetes resources
|
|
141
223
|
*/
|
|
142
224
|
|
|
143
|
-
resources?:
|
|
144
|
-
limits?: {
|
|
145
|
-
cpu?: string;
|
|
146
|
-
memory?: string;
|
|
147
|
-
};
|
|
148
|
-
requests?: {
|
|
149
|
-
cpu?: string;
|
|
150
|
-
memory?: string;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
225
|
+
resources?: KubernetesResourcesDef;
|
|
153
226
|
healthRoute?: string;
|
|
154
227
|
startupProbe?: KubernetesHealthDef;
|
|
155
228
|
readinessProbe?: KubernetesHealthDef;
|
|
156
229
|
livenessProbe?: KubernetesHealthDef;
|
|
230
|
+
/**
|
|
231
|
+
* specify a worker. A worker is a separate deployment that runs continously in the background.
|
|
232
|
+
* The worker pod can use the same entry point as the app or a different one (specify command).
|
|
233
|
+
* It has the same environment variables as the application and an additional IS_WORKER="true" variable
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
worker?: KubernetesWorkerDef;
|
|
157
237
|
}>;
|
|
238
|
+
/**
|
|
239
|
+
* load secrets from other components.
|
|
240
|
+
* Use this only in cases where the secret is not known on pipeline-time
|
|
241
|
+
* and only if the component is also in the same cluster.
|
|
242
|
+
*
|
|
243
|
+
* a typical case is reusing mongo_url from other component
|
|
244
|
+
*
|
|
245
|
+
* also make sure that the other component deploys first
|
|
246
|
+
*
|
|
247
|
+
* in all other cases use normal env var handling
|
|
248
|
+
*/
|
|
249
|
+
|
|
250
|
+
secretsFromOtherComponent?: {
|
|
251
|
+
[envVar: string]: string;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* map another services internal endpoint into a env var.
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
mapServiceUrlToEnv?: {
|
|
258
|
+
[envVar: string]: string;
|
|
259
|
+
};
|
|
158
260
|
/**
|
|
159
261
|
* Mount secrets as files in the filesystem.
|
|
160
262
|
* These secrets are still available as env vars, but will contain the path of the file instead
|
|
263
|
+
*
|
|
264
|
+
* @deprecated this will be removed in the future, because its very niche and not used
|
|
161
265
|
*/
|
|
162
266
|
|
|
163
267
|
secretsAsFile?: string[];
|
|
@@ -181,16 +285,4 @@ export declare type DeployConfigKubernetes = {
|
|
|
181
285
|
|
|
182
286
|
values?: DeployConfigKubernetesValues;
|
|
183
287
|
} & DeployConfigBase;
|
|
184
|
-
declare type DeployConfigCustom = {
|
|
185
|
-
type: "custom";
|
|
186
|
-
requiresDocker: boolean;
|
|
187
|
-
script: string[];
|
|
188
|
-
stopScript?: string[];
|
|
189
|
-
} & DeployConfigBase;
|
|
190
|
-
export declare type DeployConfig = DeployConfigKubernetes | DeployConfigCustom;
|
|
191
|
-
export declare const isOfDeployType: <T extends ("kubernetes" | "custom")[]>(t: DeployConfig | false, ...types: T) => t is Extract<DeployConfigKubernetes, {
|
|
192
|
-
type: T[number];
|
|
193
|
-
}> | Extract<DeployConfigCustom, {
|
|
194
|
-
type: T[number];
|
|
195
|
-
}>;
|
|
196
288
|
export {};
|
package/dist/deploy/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Config, Context } from "../types";
|
|
2
|
-
import { DeployConfigKubernetesCluster } from "./types";
|
|
1
|
+
import type { Config, Context } from "../types";
|
|
2
|
+
import type { DeployConfigKubernetesCluster } from "./types";
|
|
3
3
|
export declare const getFullKubernetesClusterName: (cluster: DeployConfigKubernetesCluster) => string | undefined;
|
|
4
4
|
export declare const getKubernetesNamespace: (config: Pick<Config, "customerName" | "appName">, env: string) => string;
|
|
5
5
|
export declare const contextIsStoppable: (context: Context) => boolean;
|
package/dist/deploy/utils.js
CHANGED
|
@@ -26,6 +26,10 @@ var contextIsStoppable = function (context) {
|
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
if ((0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
if ((0, types_1.isOfDeployType)(deployConfig, "custom") && deployConfig.stopScript) {
|
|
30
34
|
return true;
|
|
31
35
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Pipeline } from "../types";
|
|
2
|
-
import { Config, PipelineTrigger } from "../types/config";
|
|
1
|
+
import type { Pipeline } from "../types";
|
|
2
|
+
import type { Config, PipelineTrigger } from "../types/config";
|
|
3
3
|
export declare const createChildPipeline: <T extends "gitlab">(type: T, trigger: PipelineTrigger, config: Config) => Promise<Pipeline<T>>;
|
|
@@ -199,9 +199,9 @@ var rules_1 = require("../rules");
|
|
|
199
199
|
|
|
200
200
|
var runner_1 = require("../runner");
|
|
201
201
|
|
|
202
|
-
var
|
|
202
|
+
var jobs_1 = require("../types/jobs");
|
|
203
203
|
|
|
204
|
-
var
|
|
204
|
+
var createJobs_1 = require("./createJobs");
|
|
205
205
|
|
|
206
206
|
var createChildPipeline = function (type, trigger, config) {
|
|
207
207
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -243,7 +243,7 @@ var createChildPipeline = function (type, trigger, config) {
|
|
|
243
243
|
case 1:
|
|
244
244
|
jobs = _a.sent();
|
|
245
245
|
allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
|
|
246
|
-
stages =
|
|
246
|
+
stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
|
|
247
247
|
return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
|
|
248
248
|
return "".concat(baseStage, " ").concat(e);
|
|
249
249
|
})), false);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PipelineJob } from "../types";
|
|
2
|
-
import { Config, PipelineTrigger } from "../types/config";
|
|
1
|
+
import type { PipelineJob } from "../types";
|
|
2
|
+
import type { Config, PipelineTrigger } from "../types/config";
|
|
3
3
|
export declare const createJobs: <T extends "gitlab">(type: T, envs: string[], config: Config, componentName: string, trigger: PipelineTrigger) => Promise<Record<string, PipelineJob<T>>>;
|
|
@@ -277,18 +277,28 @@ var getFullReferencedJobName = function (referencedJobName, componentName, env,
|
|
|
277
277
|
|
|
278
278
|
|
|
279
279
|
var replaceReferences = function (job, componentName, env, allRawJobs) {
|
|
280
|
-
var _a, _b;
|
|
280
|
+
var _a, _b, _c;
|
|
281
281
|
|
|
282
282
|
var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
|
|
283
|
+
var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
|
|
284
|
+
return (0, lodash_1.isObject)(n) ? {
|
|
285
|
+
job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
|
|
286
|
+
artifacts: n.artifacts
|
|
287
|
+
} : getFullReferencedJobName(n, componentName, env, allRawJobs);
|
|
288
|
+
});
|
|
289
|
+
var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
|
|
290
|
+
return {
|
|
291
|
+
artifacts: other.artifacts,
|
|
292
|
+
job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
|
|
297
|
+
|
|
283
298
|
return __assign(__assign({}, job), {
|
|
284
299
|
stage: stage,
|
|
285
|
-
needs:
|
|
286
|
-
|
|
287
|
-
job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
|
|
288
|
-
artifacts: n.artifacts
|
|
289
|
-
} : getFullReferencedJobName(n, componentName, env, allRawJobs);
|
|
290
|
-
}),
|
|
291
|
-
environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
|
|
300
|
+
needs: needs,
|
|
301
|
+
environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
|
|
292
302
|
on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
|
|
293
303
|
}) : job.environment
|
|
294
304
|
});
|
|
@@ -357,23 +367,51 @@ var createJobs = function (type, envs, config, componentName, trigger) {
|
|
|
357
367
|
return [2
|
|
358
368
|
/*return*/
|
|
359
369
|
, envs.reduce(function (acc, env) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
370
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
371
|
+
var context, jobs, result, _a, _b, _c, _d, _e;
|
|
372
|
+
|
|
373
|
+
return __generator(this, function (_f) {
|
|
374
|
+
switch (_f.label) {
|
|
375
|
+
case 0:
|
|
376
|
+
return [4
|
|
377
|
+
/*yield*/
|
|
378
|
+
, (0, context_1.createContext)(config, componentName, env, commitInfo, packageManagerInfo)];
|
|
379
|
+
|
|
380
|
+
case 1:
|
|
381
|
+
context = _f.sent();
|
|
382
|
+
jobs = addStageNeeds(createRawJobs(context));
|
|
383
|
+
_a = [{}];
|
|
384
|
+
return [4
|
|
385
|
+
/*yield*/
|
|
386
|
+
, acc];
|
|
387
|
+
|
|
388
|
+
case 2:
|
|
389
|
+
_b = [__assign.apply(void 0, _a.concat([_f.sent()]))];
|
|
390
|
+
_d = (_c = jobs).reduce;
|
|
391
|
+
_e = [function (acc, job) {
|
|
392
|
+
var _a;
|
|
393
|
+
|
|
394
|
+
var jobWithResolvedReferences = replaceReferences(job, componentName, env, jobs);
|
|
395
|
+
var jobName = getFullJobName(job.name, componentName, job.envMode !== "none" ? env : undefined);
|
|
396
|
+
|
|
397
|
+
if (type === "gitlab") {
|
|
398
|
+
return __assign(__assign({}, acc), (_a = {}, _a[jobName] = (0, makeGitlabJob_1.makeGitlabJob)(jobWithResolvedReferences), _a));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
throw new Error("not supported");
|
|
402
|
+
}];
|
|
403
|
+
return [4
|
|
404
|
+
/*yield*/
|
|
405
|
+
, Promise.resolve({})];
|
|
406
|
+
|
|
407
|
+
case 3:
|
|
408
|
+
result = __assign.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()]))]));
|
|
409
|
+
return [2
|
|
410
|
+
/*return*/
|
|
411
|
+
, result];
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
});
|
|
377
415
|
}, {})];
|
|
378
416
|
}
|
|
379
417
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { GitlabJobDef } from "../../types";
|
|
2
|
-
import { CatladderJob } from "../../types/jobs";
|
|
1
|
+
import type { GitlabJobDef } from "../../types";
|
|
2
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
export declare const makeGitlabJob: ({
|
|
4
4
|
envMode,
|
|
5
5
|
needsStages,
|
|
6
|
+
needsOtherComponent,
|
|
6
7
|
name,
|
|
7
8
|
...rest
|
|
8
9
|
}: CatladderJob<string>) => GitlabJobDef;
|
|
@@ -33,8 +33,9 @@ var defaults_1 = require("../../defaults");
|
|
|
33
33
|
var makeGitlabJob = function (_a) {
|
|
34
34
|
var envMode = _a.envMode,
|
|
35
35
|
needsStages = _a.needsStages,
|
|
36
|
+
needsOtherComponent = _a.needsOtherComponent,
|
|
36
37
|
name = _a.name,
|
|
37
|
-
rest = __rest(_a, ["envMode", "needsStages", "name"]);
|
|
38
|
+
rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name"]);
|
|
38
39
|
|
|
39
40
|
return __assign(__assign({}, rest), {
|
|
40
41
|
retry: defaults_1.BASE_RETRY,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Config, PackageManagerInfo } from "../types";
|
|
1
|
+
import type { Config, PackageManagerInfo } from "../types";
|
|
2
2
|
export declare const getPackageManagerInfo: (config: Config, componentName: string) => Promise<PackageManagerInfo>;
|
package/dist/rules/index.d.ts
CHANGED
package/dist/runner/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
declare type RunnerImageName = "jobs-default" | "jobs-meteor" | "jobs-testing-chrome" | "kubernetes" | "base-pipeline" | "docker-build" | "semantic-release";
|
|
2
|
-
export declare const getRunnerImage: (imageName: RunnerImageName) => string;
|
|
3
|
-
export {};
|
|
1
|
+
export declare type RunnerImageName = "jobs-default" | "jobs-meteor" | "jobs-testing-chrome" | "kubernetes" | "base-pipeline" | "docker-build" | "gcloud" | "semantic-release";
|
|
2
|
+
export declare const getRunnerImage: (imageName: RunnerImageName) => string;
|