@catladder/pipeline 1.169.0 → 1.170.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/bash/replaceAsync.js +4 -3
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +2 -0
- package/dist/deploy/types/googleCloudRun.d.ts +7 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +1346 -0
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +4 -4
- package/examples/__snapshots__/multiline-var.test.ts.snap +2934 -1020
- package/examples/cloud-run-service-custom-vpc-connector.test.ts +11 -0
- package/examples/cloud-run-service-custom-vpc-connector.ts +30 -0
- package/examples/cloud-run-service-custom-vpc.ts +2 -1
- package/examples/multiline-var.ts +57 -15
- package/package.json +1 -1
- package/src/bash/replaceAsync.ts +7 -3
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +2 -0
- package/src/deploy/types/googleCloudRun.ts +10 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createYamlLocalPipeline } from "./__utils__/helpers";
|
|
2
|
+
import config from "./cloud-run-service-custom-vpc-connector";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This test is auto-generated.
|
|
6
|
+
* Modifications will be overwritten on every `yarn test` run!
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
it("matches snapshot for cloud-run-service-custom-vpc-connector local pipeline YAML", async () => {
|
|
10
|
+
expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
|
|
11
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
|
|
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: "google-cloudrun",
|
|
14
|
+
projectId: "google-project-id",
|
|
15
|
+
region: "europe-west6",
|
|
16
|
+
|
|
17
|
+
service: {
|
|
18
|
+
vpcConnector: "my-first-vpc-connector",
|
|
19
|
+
vpcEgress: "all-traffic",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default config;
|
|
27
|
+
|
|
28
|
+
export const information = {
|
|
29
|
+
title: "Cloud Run: Service with custom vpc settings",
|
|
30
|
+
};
|
|
@@ -4,20 +4,54 @@ const config: Config = {
|
|
|
4
4
|
appName: "test-app",
|
|
5
5
|
customerName: "pan",
|
|
6
6
|
components: {
|
|
7
|
-
|
|
8
|
-
dir: "
|
|
7
|
+
app1: {
|
|
8
|
+
dir: "app1",
|
|
9
9
|
build: {
|
|
10
10
|
type: "node",
|
|
11
11
|
},
|
|
12
12
|
vars: {
|
|
13
13
|
public: {
|
|
14
14
|
foo: "foo-value",
|
|
15
|
-
multiline: `line1
|
|
16
|
-
line2
|
|
17
|
-
line3
|
|
15
|
+
multiline: `app1 line1
|
|
16
|
+
app1 line2
|
|
17
|
+
app1 line3
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
the url of self: "\${ROOT_URL}"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
app1 single quote: '
|
|
23
|
+
app1 doouble quote: "
|
|
24
|
+
`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
deploy: {
|
|
28
|
+
type: "google-cloudrun",
|
|
29
|
+
projectId: "asdf",
|
|
30
|
+
region: "asia-east1",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
app2: {
|
|
34
|
+
dir: "app2",
|
|
35
|
+
build: {
|
|
36
|
+
type: "node",
|
|
37
|
+
},
|
|
38
|
+
vars: {
|
|
39
|
+
public: {
|
|
40
|
+
foo: "foo-value",
|
|
41
|
+
multiline: `app2 yeah
|
|
42
|
+
app2 yeah2
|
|
43
|
+
app2 yeah3
|
|
44
|
+
|
|
45
|
+
app2 single quote: '
|
|
46
|
+
app2 doouble quote: "
|
|
47
|
+
|
|
48
|
+
the url of self: "\${ROOT_URL}"
|
|
49
|
+
the url of app1: "\${app1:ROOT_URL}"
|
|
50
|
+
|
|
51
|
+
value from app1:
|
|
52
|
+
-------
|
|
53
|
+
\${multiline_from_app1}
|
|
54
|
+
--------
|
|
21
55
|
`,
|
|
22
56
|
},
|
|
23
57
|
},
|
|
@@ -27,20 +61,28 @@ doouble quote: "
|
|
|
27
61
|
region: "asia-east1",
|
|
28
62
|
},
|
|
29
63
|
},
|
|
30
|
-
|
|
31
|
-
dir: "
|
|
64
|
+
kube: {
|
|
65
|
+
dir: "kube",
|
|
32
66
|
build: {
|
|
33
67
|
type: "node",
|
|
34
68
|
},
|
|
35
69
|
vars: {
|
|
36
70
|
public: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
yeah2
|
|
40
|
-
yeah3
|
|
71
|
+
multiline_from_app1: "${app1:multiline}",
|
|
72
|
+
multiline: `kube yeah
|
|
73
|
+
kube yeah2
|
|
74
|
+
kube yeah3
|
|
75
|
+
|
|
76
|
+
kube single quote: '
|
|
77
|
+
kube doouble quote: "
|
|
78
|
+
|
|
79
|
+
the url of self: "\${ROOT_URL}"
|
|
80
|
+
the url of app1: "\${app1:ROOT_URL}"
|
|
41
81
|
|
|
42
|
-
|
|
43
|
-
|
|
82
|
+
value from app1:
|
|
83
|
+
-------
|
|
84
|
+
\${multiline_from_app1}
|
|
85
|
+
--------
|
|
44
86
|
`,
|
|
45
87
|
},
|
|
46
88
|
},
|
package/package.json
CHANGED
package/src/bash/replaceAsync.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BashExpression } from "./BashExpression";
|
|
1
|
+
import { BashExpression, bashEscape } from "./BashExpression";
|
|
2
2
|
|
|
3
3
|
// from https://github.com/dsblv/string-replace-async/blob/main/index.js
|
|
4
4
|
// and adjusted a bit
|
|
@@ -11,13 +11,17 @@ export default async function replaceAsync(
|
|
|
11
11
|
) => Promise<string | BashExpression>,
|
|
12
12
|
) {
|
|
13
13
|
const wasBashExpression = string instanceof BashExpression;
|
|
14
|
+
|
|
15
|
+
const stringRepresentation = wasBashExpression
|
|
16
|
+
? string.toString()
|
|
17
|
+
: bashEscape(string);
|
|
14
18
|
try {
|
|
15
19
|
// 1. Run fake pass of `replace`, collect values from `replacer` calls
|
|
16
20
|
// 2. Resolve them with `Promise.all`
|
|
17
21
|
// 3. Run `replace` with resolved values
|
|
18
22
|
const values: Array<Promise<string | BashExpression>> = [];
|
|
19
23
|
String.prototype.replace.call(
|
|
20
|
-
|
|
24
|
+
stringRepresentation,
|
|
21
25
|
searchValue,
|
|
22
26
|
function (...args) {
|
|
23
27
|
// eslint-disable-next-line prefer-spread
|
|
@@ -33,7 +37,7 @@ export default async function replaceAsync(
|
|
|
33
37
|
);
|
|
34
38
|
|
|
35
39
|
const result = String.prototype.replace.call(
|
|
36
|
-
|
|
40
|
+
stringRepresentation,
|
|
37
41
|
searchValue,
|
|
38
42
|
function () {
|
|
39
43
|
return resolvedValues.shift()?.toString() ?? "";
|
|
@@ -52,6 +52,8 @@ export const getServiceDeployScript = (
|
|
|
52
52
|
timeout: customConfig?.timeout,
|
|
53
53
|
"vpc-connector": customConfig?.vpcConnector,
|
|
54
54
|
"vpc-egress": customConfig?.vpcEgress,
|
|
55
|
+
network: customConfig?.network,
|
|
56
|
+
subnet: customConfig?.subnet,
|
|
55
57
|
"use-http2": customConfig?.http2,
|
|
56
58
|
"allow-unauthenticated": customConfig?.allowUnauthenticated ?? true,
|
|
57
59
|
ingress: customConfig?.ingress ?? "all",
|
|
@@ -158,15 +158,23 @@ export type DeployConfigCloudRunService = {
|
|
|
158
158
|
*/
|
|
159
159
|
executionEnvironment?: "gen2" | "gen1";
|
|
160
160
|
|
|
161
|
+
/* the vpc network, see https://cloud.google.com/sdk/gcloud/reference/run/deploy#--network */
|
|
162
|
+
network?: string;
|
|
163
|
+
|
|
161
164
|
/**
|
|
162
|
-
* vpc
|
|
165
|
+
* vpc subnet to use, see https://cloud.google.com/sdk/gcloud/reference/run/deploy#--subnet
|
|
163
166
|
*/
|
|
164
|
-
|
|
167
|
+
subnet?: string;
|
|
165
168
|
/**
|
|
166
169
|
* vpc egress, see https://cloud.google.com/sdk/gcloud/reference/run/deploy#--vpc-egress
|
|
167
170
|
*/
|
|
168
171
|
vpcEgress?: "all-traffic" | "private-ranges-only";
|
|
169
172
|
|
|
173
|
+
/**
|
|
174
|
+
* vpc connector
|
|
175
|
+
*/
|
|
176
|
+
vpcConnector?: string;
|
|
177
|
+
|
|
170
178
|
/**
|
|
171
179
|
* Use http2 end-to-end. See https://cloud.google.com/run/docs/configuring/http2
|
|
172
180
|
*
|