@catladder/pipeline 1.88.0 → 1.89.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/docker.d.ts +4 -18
- package/dist/build/docker.js +15 -9
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/deploy/kubernetes/kubeValues.d.ts +1 -0
- package/dist/deploy/kubernetes/kubeValues.js +9 -6
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +1 -0
- package/dist/deploy/types/kubernetes.d.ts +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +8 -20
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +8 -20
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +8 -20
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +16 -40
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +16 -40
- package/examples/__snapshots__/custom-build-job.ts.snap +8 -20
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
- package/examples/kubernetes-application-customization.ts +57 -0
- package/package.json +1 -1
- package/src/build/docker.ts +13 -6
- package/src/deploy/kubernetes/kubeValues.ts +7 -5
- package/src/deploy/types/kubernetes.ts +7 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
import { createAllPipelines } from "./__utils__/helpers";
|
|
3
|
+
const config: Config = {
|
|
4
|
+
appName: "test-app",
|
|
5
|
+
customerName: "pan",
|
|
6
|
+
components: {
|
|
7
|
+
api: {
|
|
8
|
+
dir: "api",
|
|
9
|
+
build: {
|
|
10
|
+
type: "node",
|
|
11
|
+
},
|
|
12
|
+
deploy: {
|
|
13
|
+
type: "kubernetes",
|
|
14
|
+
cluster: {
|
|
15
|
+
name: "some-cluster-name",
|
|
16
|
+
region: "europe-west6",
|
|
17
|
+
projectId: "some-project-id",
|
|
18
|
+
type: "gcloud",
|
|
19
|
+
domainCanonical: "panter.cloud",
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
values: {
|
|
23
|
+
application: {
|
|
24
|
+
command: "node main.js",
|
|
25
|
+
autoscale: {
|
|
26
|
+
minReplicas: 2,
|
|
27
|
+
maxReplicas: 5,
|
|
28
|
+
metrics: [
|
|
29
|
+
{
|
|
30
|
+
type: "Resource",
|
|
31
|
+
resource: {
|
|
32
|
+
name: "cpu",
|
|
33
|
+
|
|
34
|
+
target: {
|
|
35
|
+
type: "Utilization",
|
|
36
|
+
averageUtilization: 0.5,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
resources: {
|
|
43
|
+
limits: {
|
|
44
|
+
cpu: "1",
|
|
45
|
+
memory: "2048Mi",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
it("matches snapshot", async () => {
|
|
56
|
+
expect(await createAllPipelines(config)).toMatchSnapshot();
|
|
57
|
+
});
|
package/package.json
CHANGED
package/src/build/docker.ts
CHANGED
|
@@ -45,20 +45,24 @@ export const requiresDockerBuild = (context: Context) => {
|
|
|
45
45
|
return false;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
const getDockerBaseVariables = () => ({
|
|
49
|
+
DOCKER_HOST: "tcp://0.0.0.0:2375",
|
|
50
|
+
DOCKER_TLS_CERTDIR: "",
|
|
51
|
+
DOCKER_DRIVER: "overlay2",
|
|
52
|
+
DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
|
|
53
|
+
});
|
|
54
|
+
|
|
48
55
|
export const getDockerBuildVariables = (context: Context) => {
|
|
49
56
|
return {
|
|
50
57
|
...DOCKER_RUNNER_BUILD_VARIABLES,
|
|
51
|
-
DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
|
|
52
58
|
DOCKERFILE_ADDITIONS:
|
|
53
59
|
context.componentConfig.build.docker?.additionsBegin?.join("\n"),
|
|
54
60
|
DOCKERFILE_ADDITIONS_END:
|
|
55
61
|
context.componentConfig.build.docker?.additionsEnd?.join("\n"),
|
|
56
62
|
APP_DIR: context.componentConfig.dir,
|
|
57
|
-
DOCKER_HOST: "tcp://0.0.0.0:2375",
|
|
58
|
-
DOCKER_TLS_CERTDIR: "",
|
|
59
|
-
DOCKER_DIR: ".", // relative to componentdir
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
DOCKER_DIR: ".", // relative to componentdir
|
|
65
|
+
...getDockerBaseVariables(),
|
|
62
66
|
|
|
63
67
|
...getDockerImageVariables(context),
|
|
64
68
|
};
|
|
@@ -74,7 +78,7 @@ export const getDockerJobBaseProps = (context: Context) => {
|
|
|
74
78
|
command: ["--tls=false"],
|
|
75
79
|
},
|
|
76
80
|
],
|
|
77
|
-
variables:
|
|
81
|
+
variables: getDockerBaseVariables(),
|
|
78
82
|
};
|
|
79
83
|
};
|
|
80
84
|
export const createDockerBuildJobBase = (
|
|
@@ -89,6 +93,9 @@ export const createDockerBuildJobBase = (
|
|
|
89
93
|
...getDockerJobBaseProps(context),
|
|
90
94
|
script: script || [],
|
|
91
95
|
},
|
|
96
|
+
{
|
|
97
|
+
variables: getDockerBuildVariables(context),
|
|
98
|
+
},
|
|
92
99
|
def
|
|
93
100
|
);
|
|
94
101
|
};
|
|
@@ -20,27 +20,29 @@ const createAppConfig = (
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const { healthRoute, command, ...rest } = application ?? {};
|
|
24
|
+
|
|
23
25
|
return mergeWithMergingArrays(
|
|
24
26
|
{
|
|
25
27
|
host: context.environment.host,
|
|
26
|
-
command: context.componentConfig.build.startCommand,
|
|
28
|
+
command: command ?? context.componentConfig.build.startCommand,
|
|
27
29
|
livenessProbe: {
|
|
28
30
|
httpGet: {
|
|
29
|
-
path:
|
|
31
|
+
path: healthRoute ?? "__health",
|
|
30
32
|
},
|
|
31
33
|
},
|
|
32
34
|
readinessProbe: {
|
|
33
35
|
httpGet: {
|
|
34
|
-
path:
|
|
36
|
+
path: healthRoute ?? "__health",
|
|
35
37
|
},
|
|
36
38
|
},
|
|
37
39
|
startupProbe: {
|
|
38
40
|
httpGet: {
|
|
39
|
-
path:
|
|
41
|
+
path: healthRoute ?? "__health",
|
|
40
42
|
},
|
|
41
43
|
},
|
|
42
44
|
}, // default
|
|
43
|
-
|
|
45
|
+
rest // merge rest in
|
|
44
46
|
);
|
|
45
47
|
};
|
|
46
48
|
|
|
@@ -192,6 +192,11 @@ export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
192
192
|
application?:
|
|
193
193
|
| false
|
|
194
194
|
| AllowUnknownProps<{
|
|
195
|
+
/**
|
|
196
|
+
* command to start, defaults to build's startCommand
|
|
197
|
+
*/
|
|
198
|
+
command?: string;
|
|
199
|
+
|
|
195
200
|
/**
|
|
196
201
|
* enable, disable app deployment, defaults to true
|
|
197
202
|
*/
|
|
@@ -240,7 +245,7 @@ export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
240
245
|
*/
|
|
241
246
|
jobDefaults?: {
|
|
242
247
|
resources: KubernetesResourcesDef;
|
|
243
|
-
}
|
|
248
|
+
};
|
|
244
249
|
}>;
|
|
245
250
|
|
|
246
251
|
/**
|
|
@@ -292,5 +297,5 @@ export type DeployConfigKubernetes = {
|
|
|
292
297
|
* Custom Helm chart location.
|
|
293
298
|
* Not recommended to use.
|
|
294
299
|
*/
|
|
295
|
-
chartName?: string
|
|
300
|
+
chartName?: string;
|
|
296
301
|
} & DeployConfigBase;
|