@catladder/pipeline 0.0.0-next-e2e4f00a → 0.0.0-next-de346530
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/base/createAppBuildJob.js +3 -3
- package/dist/build/custom/testJob.js +12 -12
- package/dist/build/node/buildJob.js +1 -1
- package/dist/build/node/cache.d.ts +2 -4
- package/dist/build/node/cache.js +3 -24
- package/dist/build/node/testJob.js +11 -11
- package/dist/build/rails/build.js +1 -1
- package/dist/build/rails/test.js +8 -8
- package/dist/build/types.d.ts +0 -10
- package/dist/bundles/catladder-gitlab/index.js +74 -174
- package/dist/constants.js +1 -1
- package/dist/context/__tests__/resolveReferences.test.js +0 -22
- package/dist/context/createComponentContext.js +0 -1
- package/dist/context/getEnvironment.js +1 -2
- package/dist/context/getEnvironmentVariables.d.ts +2 -5
- package/dist/context/getEnvironmentVariables.js +17 -24
- package/dist/context/resolveReferences.d.ts +1 -4
- package/dist/context/resolveReferences.js +2 -16
- package/dist/deploy/base/deploy.js +3 -3
- package/dist/deploy/cloudRun/index.js +2 -2
- package/dist/deploy/kubernetes/cloudSql/index.js +3 -14
- package/dist/deploy/kubernetes/deployJob.js +1 -3
- package/dist/deploy/kubernetes/index.js +2 -2
- package/dist/deploy/kubernetes/kubeValues.d.ts +1 -2
- package/dist/deploy/kubernetes/kubeValues.js +2 -3
- package/dist/deploy/types/base.d.ts +0 -6
- package/dist/deploy/types/kubernetes.d.ts +1 -34
- package/dist/pipeline/gitlab/createGitlabJobs.js +3 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +0 -8
- package/dist/types/context.d.ts +0 -8
- package/dist/types/jobs.d.ts +0 -8
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +36 -52
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +1402 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +72 -136
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +48 -84
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +36 -68
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +36 -52
- package/examples/__snapshots__/custom-build-job.test.ts.snap +36 -52
- package/examples/__snapshots__/custom-deploy.test.ts.snap +24 -48
- package/examples/__snapshots__/custom-envs.test.ts.snap +18 -48
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +36 -52
- package/examples/__snapshots__/git-submodule.test.ts.snap +36 -68
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +60 -112
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +60 -112
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +120 -224
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +60 -112
- package/examples/__snapshots__/local-dot-env.test.ts.snap +36 -68
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +60 -96
- package/examples/__snapshots__/multiline-var.test.ts.snap +96 -180
- package/examples/__snapshots__/native-app.test.ts.snap +72 -132
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +36 -68
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +36 -68
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +48 -80
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +48 -80
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +48 -96
- package/examples/__snapshots__/{workspace-api-www-custom-cache.test.ts.snap → workspace-api-www-turbo-cache.test.ts.snap} +81 -153
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +76 -136
- package/examples/{workspace-api-www-custom-cache.test.ts → cloud-run-nextjs.test.ts} +2 -2
- package/examples/cloud-run-nextjs.ts +29 -0
- package/examples/native-app.ts +10 -6
- package/examples/rails-k8s-with-worker.ts +5 -1
- package/examples/{kubernetes-with-cloud-sql-legacy.test.ts → workspace-api-www-turbo-cache.test.ts} +2 -2
- package/examples/{workspace-api-www-custom-cache.ts → workspace-api-www-turbo-cache.ts} +4 -1
- package/examples/workspace-api-www.ts +3 -0
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +0 -1
- package/src/build/custom/testJob.ts +0 -1
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +0 -29
- package/src/build/node/testJob.ts +0 -1
- package/src/build/rails/build.ts +0 -1
- package/src/build/rails/test.ts +0 -1
- package/src/build/types.ts +0 -13
- package/src/context/__tests__/resolveReferences.test.ts +1 -27
- package/src/context/createComponentContext.ts +0 -1
- package/src/context/getEnvironment.ts +1 -1
- package/src/context/getEnvironmentVariables.ts +13 -34
- package/src/context/resolveReferences.ts +0 -13
- package/src/deploy/base/deploy.ts +1 -1
- package/src/deploy/cloudRun/index.ts +2 -2
- package/src/deploy/kubernetes/cloudSql/index.ts +1 -15
- package/src/deploy/kubernetes/deployJob.ts +0 -2
- package/src/deploy/kubernetes/index.ts +2 -2
- package/src/deploy/kubernetes/kubeValues.ts +5 -8
- package/src/deploy/types/base.ts +0 -6
- package/src/deploy/types/kubernetes.ts +1 -36
- package/src/pipeline/gitlab/createGitlabJobs.ts +1 -4
- package/src/types/config.ts +0 -8
- package/src/types/context.ts +1 -8
- package/src/types/jobs.ts +0 -8
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +0 -85
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +0 -33
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.test.ts.snap +0 -1791
- package/examples/kubernetes-with-cloud-sql-legacy.ts +0 -35
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +0 -35
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createYamlLocalPipeline } from "./__utils__/helpers";
|
|
2
|
-
import config from "./
|
|
2
|
+
import config from "./cloud-run-nextjs";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This test is auto-generated.
|
|
6
6
|
* Modifications will be overwritten on every `yarn test` run!
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
it("matches snapshot for
|
|
9
|
+
it("matches snapshot for cloud-run-nextjs local pipeline YAML", async () => {
|
|
10
10
|
expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
|
|
11
11
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Config } from "../src";
|
|
2
|
+
|
|
3
|
+
const config: Config = {
|
|
4
|
+
appName: "test-app",
|
|
5
|
+
customerName: "pan",
|
|
6
|
+
components: {
|
|
7
|
+
www: {
|
|
8
|
+
dotEnv: true,
|
|
9
|
+
dir: "www",
|
|
10
|
+
build: {
|
|
11
|
+
type: "node",
|
|
12
|
+
cache: {
|
|
13
|
+
paths: [".next/cache"],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
deploy: {
|
|
17
|
+
type: "google-cloudrun",
|
|
18
|
+
projectId: "google-project-id",
|
|
19
|
+
region: "europe-west6",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default config;
|
|
26
|
+
|
|
27
|
+
export const information = {
|
|
28
|
+
title: "Cloud Run: With SQL",
|
|
29
|
+
};
|
package/examples/native-app.ts
CHANGED
|
@@ -28,9 +28,11 @@ const config: Config = {
|
|
|
28
28
|
],
|
|
29
29
|
},
|
|
30
30
|
build: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
jobVars: {
|
|
32
|
+
public: {
|
|
33
|
+
LC_A: "L=en_US.UTF-8",
|
|
34
|
+
LANG: "en_US.UTF-8",
|
|
35
|
+
},
|
|
34
36
|
},
|
|
35
37
|
type: "node",
|
|
36
38
|
buildCommand: [
|
|
@@ -46,9 +48,11 @@ const config: Config = {
|
|
|
46
48
|
|
|
47
49
|
deploy: {
|
|
48
50
|
type: "custom",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
jobVars: {
|
|
52
|
+
public: {
|
|
53
|
+
LC_A: "L=en_US.UTF-8",
|
|
54
|
+
LANG: "en_US.UTF-8",
|
|
55
|
+
},
|
|
52
56
|
},
|
|
53
57
|
requiresDocker: false,
|
|
54
58
|
script: [
|
|
@@ -44,7 +44,11 @@ const config: Config = {
|
|
|
44
44
|
domainCanonical: "panter.cloud",
|
|
45
45
|
},
|
|
46
46
|
values: {
|
|
47
|
-
cloudsql: {
|
|
47
|
+
cloudsql: {
|
|
48
|
+
enabled: true,
|
|
49
|
+
type: "unmanaged",
|
|
50
|
+
instanceConnectionName: "myproject:europe-west6:instance-name",
|
|
51
|
+
},
|
|
48
52
|
application: {
|
|
49
53
|
// if deployed to Google Cloud Run use a gem like cloudtasker instead of a permanently running expensive worker
|
|
50
54
|
worker: {
|
package/examples/{kubernetes-with-cloud-sql-legacy.test.ts → workspace-api-www-turbo-cache.test.ts}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createYamlLocalPipeline } from "./__utils__/helpers";
|
|
2
|
-
import config from "./
|
|
2
|
+
import config from "./workspace-api-www-turbo-cache";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This test is auto-generated.
|
|
6
6
|
* Modifications will be overwritten on every `yarn test` run!
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
it("matches snapshot for
|
|
9
|
+
it("matches snapshot for workspace-api-www-turbo-cache local pipeline YAML", async () => {
|
|
10
10
|
expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
|
|
11
11
|
});
|
|
@@ -12,7 +12,7 @@ const config: Config = {
|
|
|
12
12
|
myWorkspace: {
|
|
13
13
|
type: "node",
|
|
14
14
|
cache: {
|
|
15
|
-
paths: [".
|
|
15
|
+
paths: [".turbo"],
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
},
|
|
@@ -33,6 +33,9 @@ const config: Config = {
|
|
|
33
33
|
dir: "www",
|
|
34
34
|
build: {
|
|
35
35
|
from: "myWorkspace",
|
|
36
|
+
cache: {
|
|
37
|
+
paths: [".next/cache"],
|
|
38
|
+
},
|
|
36
39
|
},
|
|
37
40
|
deploy: DEPLOY_CONFIG,
|
|
38
41
|
vars: {
|
package/package.json
CHANGED
|
@@ -31,7 +31,6 @@ export const createCustomTestJobs = (
|
|
|
31
31
|
variables: {
|
|
32
32
|
APP_PATH: context.build.dir,
|
|
33
33
|
...context.environment.jobOnlyVars.build.envVars,
|
|
34
|
-
...(buildConfig.extraVars ?? {}),
|
|
35
34
|
},
|
|
36
35
|
runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
|
|
37
36
|
services: buildConfig.jobServices,
|
|
@@ -13,7 +13,7 @@ import { createBuildJobDefinition } from "../base/createBuildJobDefinition";
|
|
|
13
13
|
import type { DockerBuildJobDefinition } from "../docker";
|
|
14
14
|
import { getDockerBuildScriptWithBuiltInDockerFile } from "../docker";
|
|
15
15
|
import type { BuildConfigDocker } from "../types";
|
|
16
|
-
import {
|
|
16
|
+
import { getNodeCache, getYarnCache } from "./cache";
|
|
17
17
|
import { getDockerAppCopyAndBuildScript, getYarnInstall } from "./yarn";
|
|
18
18
|
|
|
19
19
|
export const createNodeBuildJobs = (
|
|
@@ -41,7 +41,7 @@ export const createNodeBuildJobDefinition = (
|
|
|
41
41
|
const yarnInstall = getYarnInstall(context);
|
|
42
42
|
return createBuildJobDefinition(context, buildConfig, {
|
|
43
43
|
prescript: yarnInstall,
|
|
44
|
-
cache:
|
|
44
|
+
cache: getNodeCache(context),
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
|
package/src/build/node/cache.ts
CHANGED
|
@@ -63,34 +63,5 @@ export const getNodeCache = (
|
|
|
63
63
|
return [
|
|
64
64
|
...getYarnCache(context, policy),
|
|
65
65
|
...getNodeModulesCache(context, policy),
|
|
66
|
-
...(context.type === "workspace" ? getWorkspaceDefaultCaches(context) : []),
|
|
67
|
-
];
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const getNextCache = (context: Context): CacheConfig[] => {
|
|
71
|
-
const paths = context.build
|
|
72
|
-
.getComponentDirs("direct")
|
|
73
|
-
.map((c) => join(c, ".next/cache"));
|
|
74
|
-
|
|
75
|
-
return [
|
|
76
|
-
{
|
|
77
|
-
pathMode: "absolute",
|
|
78
|
-
key: "next-cache",
|
|
79
|
-
policy: "pull-push",
|
|
80
|
-
paths,
|
|
81
|
-
},
|
|
82
|
-
];
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const getWorkspaceDefaultCaches = (
|
|
86
|
-
context: WorkspaceContext,
|
|
87
|
-
): CacheConfig[] => {
|
|
88
|
-
return [
|
|
89
|
-
{
|
|
90
|
-
// turbo repo
|
|
91
|
-
key: "turbo",
|
|
92
|
-
policy: "pull-push",
|
|
93
|
-
paths: [".turbo"],
|
|
94
|
-
},
|
|
95
66
|
];
|
|
96
67
|
};
|
package/src/build/rails/build.ts
CHANGED
package/src/build/rails/test.ts
CHANGED
package/src/build/types.ts
CHANGED
|
@@ -82,12 +82,6 @@ export type BuildConfigBase = {
|
|
|
82
82
|
* Can curently not reference other variables from other components
|
|
83
83
|
*/
|
|
84
84
|
jobVars?: EnvVars;
|
|
85
|
-
/**
|
|
86
|
-
* additional env vars for the buid jobs
|
|
87
|
-
*
|
|
88
|
-
* @deprecated use jobVars or runnerVariables
|
|
89
|
-
*/
|
|
90
|
-
extraVars?: Record<string, string>;
|
|
91
85
|
|
|
92
86
|
/**
|
|
93
87
|
* additional vars only for the runner.
|
|
@@ -232,13 +226,6 @@ export type BuildConfigDocker =
|
|
|
232
226
|
| BuildConfigDockerBuiltIn
|
|
233
227
|
| BuildConfigDockerCustom;
|
|
234
228
|
|
|
235
|
-
/**
|
|
236
|
-
* @deprecated this type is no longer used. Use {@link BuildConfigDocker} instead.
|
|
237
|
-
*/
|
|
238
|
-
export type BuildConfigCustomDocker =
|
|
239
|
-
| BuildConfigDockerCustom
|
|
240
|
-
| BuildConfigDockerBuiltInNgninx;
|
|
241
|
-
|
|
242
229
|
export type BuildConfigCustom = Omit<
|
|
243
230
|
BuildConfigBase,
|
|
244
231
|
"lint" | "test" | "audit"
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { BashExpression } from "../../bash/BashExpression";
|
|
2
|
-
import {
|
|
3
|
-
resolveReferences,
|
|
4
|
-
translateLegacyFromComponents,
|
|
5
|
-
} from "../resolveReferences";
|
|
2
|
+
import { resolveReferences } from "../resolveReferences";
|
|
6
3
|
|
|
7
4
|
const unpackBashExpressions = (obj: Record<string, string | BashExpression>) =>
|
|
8
5
|
Object.fromEntries(
|
|
@@ -123,26 +120,3 @@ describe("resolveReferences", () => {
|
|
|
123
120
|
});
|
|
124
121
|
});
|
|
125
122
|
});
|
|
126
|
-
|
|
127
|
-
describe("translateLegacyFromComponents", () => {
|
|
128
|
-
it("translatetes the old `fromComponents` approach to ${componentName:variableName}", () => {
|
|
129
|
-
const fromComponents = {
|
|
130
|
-
api: {
|
|
131
|
-
API_FOO: "FOO",
|
|
132
|
-
API_BAR: "BAR",
|
|
133
|
-
},
|
|
134
|
-
www: {
|
|
135
|
-
WWW_X: "X",
|
|
136
|
-
WWW_Y: "Y",
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const result = translateLegacyFromComponents(fromComponents);
|
|
141
|
-
expect(result).toEqual({
|
|
142
|
-
API_FOO: "${api:FOO}",
|
|
143
|
-
API_BAR: "${api:BAR}",
|
|
144
|
-
WWW_X: "${www:X}",
|
|
145
|
-
WWW_Y: "${www:Y}",
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|
|
@@ -108,7 +108,6 @@ export const createComponentContext = async (
|
|
|
108
108
|
const context: Omit<ComponentContext, "customJobs"> = {
|
|
109
109
|
type: "component",
|
|
110
110
|
name: ctx.componentName,
|
|
111
|
-
componentName: ctx.componentName,
|
|
112
111
|
env: ctx.env,
|
|
113
112
|
fullConfig: ctx.config,
|
|
114
113
|
componentConfig,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { merge } from "lodash";
|
|
2
1
|
import { DEPLOY_TYPES } from "../deploy";
|
|
3
2
|
import type {
|
|
4
3
|
ComponentContext,
|
|
@@ -13,10 +12,7 @@ import { isStandaloneBuildConfig } from "../build/types";
|
|
|
13
12
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
14
13
|
import { getBuildInfoVariables } from "./getBuildInfoVariables";
|
|
15
14
|
import { getEnvironmentContext } from "./getEnvironmentContext";
|
|
16
|
-
import {
|
|
17
|
-
resolveReferences,
|
|
18
|
-
translateLegacyFromComponents,
|
|
19
|
-
} from "./resolveReferences";
|
|
15
|
+
import { resolveReferences } from "./resolveReferences";
|
|
20
16
|
import { transformJobOnlyVars } from "./transformJobOnlyVars";
|
|
21
17
|
import {
|
|
22
18
|
makeSecretEnvVarMapping,
|
|
@@ -43,12 +39,9 @@ type BasePredefinedVariables = ReturnType<typeof getBasePredefinedVariables>;
|
|
|
43
39
|
|
|
44
40
|
// we export so that we have later nice autocomplete
|
|
45
41
|
export type PredefinedVariables = BasePredefinedVariables & {
|
|
46
|
-
|
|
47
|
-
* undefined in rails, Rails before 6.1 (mis)uses the `HOST` environment variable to specify the IP to bind to
|
|
48
|
-
*/
|
|
49
|
-
HOST?: StringOrBashExpression;
|
|
42
|
+
HOSTNAME?: StringOrBashExpression;
|
|
50
43
|
ROOT_URL: StringOrBashExpression;
|
|
51
|
-
|
|
44
|
+
HOSTNAME_INTERNAL: StringOrBashExpression;
|
|
52
45
|
ROOT_URL_INTERNAL: StringOrBashExpression;
|
|
53
46
|
};
|
|
54
47
|
|
|
@@ -78,12 +71,8 @@ export const getEnvironmentVariables = async (
|
|
|
78
71
|
...basePredefinedVariables,
|
|
79
72
|
ENV_SHORT: "local",
|
|
80
73
|
ROOT_URL: url,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
buildConfigRaw.type === "rails"
|
|
84
|
-
? {}
|
|
85
|
-
: { HOST: host }),
|
|
86
|
-
HOST_INTERNAL: host,
|
|
74
|
+
HOSTNAME: host,
|
|
75
|
+
HOSTNAME_INTERNAL: host,
|
|
87
76
|
ROOT_URL_INTERNAL: "http://" + host,
|
|
88
77
|
PORT: port.toString(),
|
|
89
78
|
};
|
|
@@ -94,10 +83,10 @@ export const getEnvironmentVariables = async (
|
|
|
94
83
|
)
|
|
95
84
|
: {};
|
|
96
85
|
|
|
97
|
-
const
|
|
98
|
-
additionalEnvVars.
|
|
86
|
+
const HOSTNAME_INTERNAL =
|
|
87
|
+
additionalEnvVars.HOSTNAME_INTERNAL ?? "unknown-host.example.com";
|
|
99
88
|
|
|
100
|
-
host = envConfigRaw?.host ??
|
|
89
|
+
host = envConfigRaw?.host ?? HOSTNAME_INTERNAL;
|
|
101
90
|
url = joinBashExpressions(["https://", host]);
|
|
102
91
|
|
|
103
92
|
predefinedVariables = {
|
|
@@ -106,12 +95,11 @@ export const getEnvironmentVariables = async (
|
|
|
106
95
|
...(isStandaloneBuildConfig(buildConfigRaw) &&
|
|
107
96
|
buildConfigRaw.type === "rails"
|
|
108
97
|
? {}
|
|
109
|
-
: {
|
|
98
|
+
: { HOSTNAME: host }),
|
|
110
99
|
ROOT_URL: url,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
ROOT_URL_INTERNAL: joinBashExpressions(["https://", HOST_INTERNAL]),
|
|
100
|
+
HOSTNAME_INTERNAL,
|
|
101
|
+
|
|
102
|
+
ROOT_URL_INTERNAL: joinBashExpressions(["https://", HOSTNAME_INTERNAL]),
|
|
115
103
|
...additionalEnvVars,
|
|
116
104
|
};
|
|
117
105
|
}
|
|
@@ -132,17 +120,8 @@ export const getEnvironmentVariables = async (
|
|
|
132
120
|
componentName,
|
|
133
121
|
secretEnvVarKeys,
|
|
134
122
|
);
|
|
135
|
-
// this is deprecated, we now support: $componentname:FOO
|
|
136
|
-
const legacyFromComponents = envConfigRaw.vars?.fromComponents ?? {};
|
|
137
|
-
const publicEnvVarsRawWithLegacyFromComponents = merge(
|
|
138
|
-
{},
|
|
139
|
-
translateLegacyFromComponents(legacyFromComponents),
|
|
140
|
-
publicEnvVarsRaw,
|
|
141
|
-
);
|
|
142
123
|
|
|
143
|
-
const publicEnvVarsRawSanitized = stringifyValues(
|
|
144
|
-
publicEnvVarsRawWithLegacyFromComponents,
|
|
145
|
-
);
|
|
124
|
+
const publicEnvVarsRawSanitized = stringifyValues(publicEnvVarsRaw);
|
|
146
125
|
|
|
147
126
|
const envVarsRaw = addIndexVar({
|
|
148
127
|
...predefinedVariables,
|
|
@@ -78,16 +78,3 @@ export const resolveReferences = async (
|
|
|
78
78
|
),
|
|
79
79
|
) as Record<string, BashExpression>;
|
|
80
80
|
};
|
|
81
|
-
|
|
82
|
-
export const translateLegacyFromComponents = (
|
|
83
|
-
fromComponents: Record<string, Record<string, string>>,
|
|
84
|
-
) => {
|
|
85
|
-
return Object.fromEntries(
|
|
86
|
-
Object.entries(fromComponents).flatMap(([componentName, variables]) => {
|
|
87
|
-
return Object.entries(variables).map(([ourName, otherName]) => [
|
|
88
|
-
ourName,
|
|
89
|
-
"${" + componentName + ":" + otherName + "}",
|
|
90
|
-
]);
|
|
91
|
-
}),
|
|
92
|
-
);
|
|
93
|
-
};
|
|
@@ -117,7 +117,7 @@ export const createDeployJob = (
|
|
|
117
117
|
...context.environment.envVars,
|
|
118
118
|
...(hasDocker ? getDockerImageVariables(context) : {}),
|
|
119
119
|
...context.environment.jobOnlyVars.deploy.envVars,
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
...jobDefinition.variables,
|
|
122
122
|
},
|
|
123
123
|
runnerVariables: {
|
|
@@ -85,7 +85,7 @@ export const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigCloudRun>
|
|
|
85
85
|
getAdditionalEnvVars: (ctx) => {
|
|
86
86
|
const { fullName, env, componentName, deployConfigRaw } = ctx;
|
|
87
87
|
|
|
88
|
-
const
|
|
88
|
+
const HOSTNAME_INTERNAL = joinBashExpressions(
|
|
89
89
|
[
|
|
90
90
|
fullName,
|
|
91
91
|
getBashVariable(
|
|
@@ -113,7 +113,7 @@ export const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigCloudRun>
|
|
|
113
113
|
: {};
|
|
114
114
|
|
|
115
115
|
return {
|
|
116
|
-
|
|
116
|
+
HOSTNAME_INTERNAL,
|
|
117
117
|
...getCloudSqlVariables(ctx),
|
|
118
118
|
...jobTriggers,
|
|
119
119
|
DEPLOY_CLOUD_RUN_PROJECT_ID: deployConfigRaw
|
|
@@ -41,21 +41,7 @@ export const createKubernetesCloudsqlBaseValues = (
|
|
|
41
41
|
context,
|
|
42
42
|
"cloudsqlProxyCredentials",
|
|
43
43
|
)}`;
|
|
44
|
-
if (config
|
|
45
|
-
const instanceConnectionName = `${config.projectId ?? "skynet-164509"}:${
|
|
46
|
-
config.region ?? "europe-west6"
|
|
47
|
-
}:${config.instanceId ?? context.environment.envVars.KUBE_NAMESPACE}`;
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
cloudsql: {
|
|
51
|
-
enabled: config.enabled,
|
|
52
|
-
dbUser: "postgres",
|
|
53
|
-
instanceConnectionName,
|
|
54
|
-
proxyCredentials,
|
|
55
|
-
fullDbName: context.environment.envVars.KUBE_APP_NAME ?? "",
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
} else if (config.type === "unmanaged") {
|
|
44
|
+
if (config.type === "unmanaged") {
|
|
59
45
|
return {
|
|
60
46
|
cloudsql: {
|
|
61
47
|
enabled: config.enabled,
|
|
@@ -29,7 +29,7 @@ export const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigKubernetes
|
|
|
29
29
|
fullConfig.domainCanonical ||
|
|
30
30
|
"panter.cloud";
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const HOSTNAME_INTERNAL = joinBashExpressions(
|
|
33
33
|
[
|
|
34
34
|
componentSlug,
|
|
35
35
|
...(envType === "review" && reviewSlug ? [reviewSlug] : []),
|
|
@@ -44,7 +44,7 @@ export const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigKubernetes
|
|
|
44
44
|
KUBE_NAMESPACE,
|
|
45
45
|
KUBE_APP_NAME,
|
|
46
46
|
KUBE_APP_NAME_PREFIX,
|
|
47
|
-
|
|
47
|
+
HOSTNAME_INTERNAL,
|
|
48
48
|
};
|
|
49
49
|
},
|
|
50
50
|
};
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import { createKubeEnv } from "./kubeEnv";
|
|
13
13
|
import { createMongodbBaseConfig } from "./mongodb";
|
|
14
|
-
import { processSecretsAsFiles } from "./processSecretsAsFiles";
|
|
15
14
|
|
|
16
15
|
const createAppConfig = (
|
|
17
16
|
context: ComponentContext,
|
|
@@ -87,14 +86,12 @@ export const createKubeValues = (context: ComponentContext) => {
|
|
|
87
86
|
: {},
|
|
88
87
|
);
|
|
89
88
|
|
|
90
|
-
const kubeValues =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
cronjobs: removeFalsy(cronjobs),
|
|
89
|
+
const kubeValues = mergeWithMergingArrays(defaultKubeValues, {
|
|
90
|
+
jobs: removeFalsy(jobs),
|
|
91
|
+
cronjobs: removeFalsy(cronjobs),
|
|
94
92
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
);
|
|
93
|
+
...rest,
|
|
94
|
+
});
|
|
98
95
|
|
|
99
96
|
return kubeValues;
|
|
100
97
|
};
|
package/src/deploy/types/base.ts
CHANGED
|
@@ -25,12 +25,6 @@ export type DeployConfigBase = {
|
|
|
25
25
|
*/
|
|
26
26
|
jobVars?: EnvVars;
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* additional env vars for the deploy job
|
|
30
|
-
*
|
|
31
|
-
* @deprecated use deploy.jobVars for deploy job specific variables
|
|
32
|
-
*/
|
|
33
|
-
extraVars?: Record<string, string>;
|
|
34
28
|
/**
|
|
35
29
|
* additional vars only for the runner.
|
|
36
30
|
* Also if you use services: that require env vars, you need to set them here.
|
|
@@ -164,33 +164,6 @@ export type DeployConfigMongodbReplicaset = {
|
|
|
164
164
|
export type DeployConfigMongodb = DeployConfigMongodbBase &
|
|
165
165
|
(DeployConfigMongodbStandalone | DeployConfigMongodbReplicaset);
|
|
166
166
|
|
|
167
|
-
/**
|
|
168
|
-
* @deprecated use config with instanceConnectionName
|
|
169
|
-
*/
|
|
170
|
-
type DeployConfigKubernetesValuesCloudSQLLegacy = {
|
|
171
|
-
enabled: boolean;
|
|
172
|
-
/**
|
|
173
|
-
* @deprecated use config with instanceConnectionName
|
|
174
|
-
*/
|
|
175
|
-
instanceId?: string;
|
|
176
|
-
/**
|
|
177
|
-
* @deprecated use config with instanceConnectionName
|
|
178
|
-
*/
|
|
179
|
-
projectId?: string;
|
|
180
|
-
/**
|
|
181
|
-
* @deprecated use config with instanceConnectionName
|
|
182
|
-
*/
|
|
183
|
-
region?: string;
|
|
184
|
-
/**
|
|
185
|
-
* @deprecated use type "unmanaged".
|
|
186
|
-
*
|
|
187
|
-
* Be aware that "unmanaged" is not fully backward compatible with "legacy".
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*/
|
|
191
|
-
type?: "legacy";
|
|
192
|
-
};
|
|
193
|
-
|
|
194
167
|
export type DeployConfigKubernetesValuesCloudSQLUnmanaged = {
|
|
195
168
|
enabled: boolean;
|
|
196
169
|
instanceConnectionName: string;
|
|
@@ -220,8 +193,7 @@ export type DeployConfigKubernetesValuesCloudSQLUnmanaged = {
|
|
|
220
193
|
dbBaseName?: string;
|
|
221
194
|
};
|
|
222
195
|
export type DeployConfigKubernetesValuesCloudSQL =
|
|
223
|
-
|
|
224
|
-
| DeployConfigKubernetesValuesCloudSQLUnmanaged;
|
|
196
|
+
DeployConfigKubernetesValuesCloudSQLUnmanaged;
|
|
225
197
|
export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
226
198
|
/**
|
|
227
199
|
* enable cloudsql db. Currently you have to manually set it up
|
|
@@ -358,13 +330,6 @@ export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
358
330
|
mapServiceUrlToEnv?: {
|
|
359
331
|
[envVar: string]: string;
|
|
360
332
|
};
|
|
361
|
-
/**
|
|
362
|
-
* Mount secrets as files in the filesystem.
|
|
363
|
-
* These secrets are still available as env vars, but will contain the path of the file instead
|
|
364
|
-
*
|
|
365
|
-
* @deprecated this will be removed in the future, because its very niche and not used
|
|
366
|
-
*/
|
|
367
|
-
secretsAsFile?: string[];
|
|
368
333
|
}>;
|
|
369
334
|
|
|
370
335
|
export type DeployConfigKubernetes = {
|
|
@@ -106,7 +106,6 @@ export const makeGitlabJob = (
|
|
|
106
106
|
environment,
|
|
107
107
|
envMode,
|
|
108
108
|
needsStages,
|
|
109
|
-
needsOtherComponent,
|
|
110
109
|
name,
|
|
111
110
|
needs,
|
|
112
111
|
jobTags,
|
|
@@ -310,7 +309,7 @@ function deduplicateNeeds(needs: GitlabJobDef["needs"]): GitlabJobDef["needs"] {
|
|
|
310
309
|
|
|
311
310
|
function getGitlabNeedsForComponentJob(
|
|
312
311
|
context: ComponentContext,
|
|
313
|
-
{ needsStages, needs
|
|
312
|
+
{ needsStages, needs }: CatladderJob<string>,
|
|
314
313
|
allJobs: AllCatladderJobs,
|
|
315
314
|
): GitlabJobDef["needs"] {
|
|
316
315
|
const needsFromStages = needsStages?.flatMap<CatladderJobNeed>((n) => {
|
|
@@ -353,8 +352,6 @@ function getGitlabNeedsForComponentJob(
|
|
|
353
352
|
const cleanedNeeds: CatladderJob["needs"] = [
|
|
354
353
|
...(needsFromStages ?? []),
|
|
355
354
|
...(needs ?? []),
|
|
356
|
-
// pull in legacy needs from other component, which is now identical to needs
|
|
357
|
-
...(needsOtherComponent ?? []),
|
|
358
355
|
];
|
|
359
356
|
|
|
360
357
|
return cleanedNeeds
|
package/src/types/config.ts
CHANGED
|
@@ -73,14 +73,6 @@ export type EnvVars = {
|
|
|
73
73
|
* secret env vars. These vars can be managed with catladder/cli
|
|
74
74
|
*/
|
|
75
75
|
secret?: string[];
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated, use ${componentName:variableName} instead
|
|
78
|
-
*
|
|
79
|
-
* With fromComponents you can inject env vars from other components.
|
|
80
|
-
*/
|
|
81
|
-
fromComponents?: {
|
|
82
|
-
[otherApp: string]: Record<string, string>;
|
|
83
|
-
};
|
|
84
76
|
};
|
|
85
77
|
|
|
86
78
|
export type DefaultEnvConfig = {
|