@catladder/pipeline 1.54.0 → 1.55.1
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/index.d.ts +2 -1
- package/dist/build/types.d.ts +3 -0
- package/dist/bundles/catladder-gitlab/index.js +3 -3
- package/dist/constants.js +1 -1
- package/dist/context/getEnvConfig.d.ts +2 -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 +2 -4
- package/dist/context/getEnvironment.js +15 -195
- 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/index.d.ts +1 -0
- package/dist/context/index.js +12 -16
- package/dist/deploy/cloudRun/deployJob.js +61 -24
- package/dist/deploy/cloudRun/index.d.ts +1 -6
- package/dist/deploy/cloudRun/index.js +51 -31
- package/dist/deploy/index.d.ts +7 -20
- package/dist/deploy/index.js +8 -21
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -3
- package/dist/deploy/kubernetes/additionalSecretKeys.js +5 -5
- package/dist/deploy/kubernetes/index.js +2 -2
- package/dist/deploy/types/googleCloudRun.d.ts +27 -23
- package/dist/deploy/types/index.d.ts +2 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/environmentContext.d.ts +22 -0
- package/dist/types/environmentContext.js +3 -0
- package/package.json +1 -1
- package/src/build/index.ts +4 -1
- package/src/build/types.ts +6 -0
- package/src/context/getEnvConfig.ts +21 -0
- package/src/context/getEnvType.ts +17 -0
- package/src/context/getEnvironment.ts +16 -164
- package/src/context/getEnvironmentContext.ts +57 -0
- package/src/context/getEnvironmentVariables.ts +152 -0
- package/src/context/index.ts +17 -14
- package/src/deploy/cloudRun/deployJob.ts +75 -24
- package/src/deploy/cloudRun/index.ts +12 -23
- package/src/deploy/index.ts +11 -23
- package/src/deploy/kubernetes/additionalSecretKeys.ts +7 -7
- package/src/deploy/kubernetes/index.ts +2 -2
- package/src/deploy/types/googleCloudRun.ts +25 -23
- package/src/types/config.ts +2 -0
- package/src/types/environmentContext.ts +26 -0
package/src/deploy/index.ts
CHANGED
|
@@ -1,39 +1,27 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Context } from "../types/context";
|
|
2
|
+
import type { EnvironmentContext } from "../types/environmentContext";
|
|
3
3
|
import type { CatladderJob } from "../types/jobs";
|
|
4
|
-
import {
|
|
4
|
+
import { GCLOUD_RUN_DEPLOY_TYPE } from "./cloudRun";
|
|
5
5
|
import { CUSTOM_DEPLOY_TYPE } from "./custom";
|
|
6
6
|
import { DOCKER_TAG_DEPLOY_TYPE } from "./dockerTag";
|
|
7
7
|
import { KUBERNETES_DEPLOY_TYPE } from "./kubernetes";
|
|
8
8
|
import type { DeployConfigGeneric, DeployConfigType } from "./types";
|
|
9
|
+
export * from "./cloudRun";
|
|
10
|
+
export * from "./cloudSql";
|
|
9
11
|
export * from "./kubernetes";
|
|
10
12
|
export * from "./types";
|
|
11
13
|
export * from "./utils";
|
|
12
14
|
|
|
13
|
-
export type EnvVarContext<D extends DeployConfigType> = {
|
|
14
|
-
deployConfig: false | DeployConfigGeneric<D>;
|
|
15
|
-
commitInfo?: CommitInfo;
|
|
16
|
-
env: string;
|
|
17
|
-
envType: EnvType;
|
|
18
|
-
componentName: string;
|
|
19
|
-
fullName: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* the full catladder config
|
|
23
|
-
*/
|
|
24
|
-
fullConfig: Config;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
15
|
export type DeployTypeDefinition<T extends DeployConfigType> = {
|
|
28
16
|
jobs: (context: Context) => CatladderJob[];
|
|
29
|
-
defaults: (
|
|
30
|
-
|
|
17
|
+
defaults: (
|
|
18
|
+
envContext: EnvironmentContext<any, T>
|
|
19
|
+
) => Partial<DeployConfigGeneric<T>>;
|
|
20
|
+
additionalSecretKeys: (envContext: EnvironmentContext<any, T>) => string[];
|
|
31
21
|
getAdditionalEnvVars: (
|
|
32
|
-
|
|
22
|
+
envContext: EnvironmentContext<any, T>
|
|
33
23
|
) => Record<string, string | undefined | null>;
|
|
34
24
|
};
|
|
35
|
-
export * from "./cloudSql";
|
|
36
|
-
export * from "./cloudRun";
|
|
37
25
|
export type DeployTypes = {
|
|
38
26
|
[T in DeployConfigType]: DeployTypeDefinition<T>;
|
|
39
27
|
};
|
|
@@ -42,5 +30,5 @@ export const DEPLOY_TYPES: DeployTypes = {
|
|
|
42
30
|
kubernetes: KUBERNETES_DEPLOY_TYPE,
|
|
43
31
|
custom: CUSTOM_DEPLOY_TYPE,
|
|
44
32
|
dockerTag: DOCKER_TAG_DEPLOY_TYPE,
|
|
45
|
-
|
|
33
|
+
"google-cloudrun": GCLOUD_RUN_DEPLOY_TYPE,
|
|
46
34
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EnvironmentContext } from "../../types/environmentContext";
|
|
2
2
|
|
|
3
3
|
export const additionalKubernetesSecretKeys = ({
|
|
4
|
-
|
|
5
|
-
}:
|
|
6
|
-
if (!
|
|
4
|
+
deployConfigRaw,
|
|
5
|
+
}: EnvironmentContext<any, "kubernetes">) => {
|
|
6
|
+
if (!deployConfigRaw) {
|
|
7
7
|
return [];
|
|
8
8
|
}
|
|
9
9
|
const keys = [];
|
|
10
|
-
if (
|
|
10
|
+
if (deployConfigRaw.values?.mongodb?.enabled) {
|
|
11
11
|
keys.push("MONGODB_ROOT_PASSWORD");
|
|
12
|
-
if (
|
|
12
|
+
if (deployConfigRaw.values.mongodb.architecture === "replicaset") {
|
|
13
13
|
keys.push("MONGODB_REPLICASET_KEY");
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
if (
|
|
17
|
+
if (deployConfigRaw.values?.cloudsql?.enabled) {
|
|
18
18
|
keys.push("POSTGRESQL_PASSWORD");
|
|
19
19
|
keys.push("cloudsqlProxyCredentials");
|
|
20
20
|
}
|
|
@@ -11,7 +11,7 @@ export const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<"kubernetes"> = {
|
|
|
11
11
|
getAdditionalEnvVars: ({
|
|
12
12
|
componentName,
|
|
13
13
|
fullConfig,
|
|
14
|
-
|
|
14
|
+
deployConfigRaw,
|
|
15
15
|
env,
|
|
16
16
|
envType,
|
|
17
17
|
commitInfo,
|
|
@@ -27,7 +27,7 @@ export const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<"kubernetes"> = {
|
|
|
27
27
|
: env;
|
|
28
28
|
|
|
29
29
|
const domainCanonical =
|
|
30
|
-
(
|
|
30
|
+
(deployConfigRaw && deployConfigRaw.cluster?.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
|
|
31
31
|
fullConfig.domainCanonical ||
|
|
32
32
|
"panter.cloud";
|
|
33
33
|
const HOST_CANONICAL = `${componentSlug}.${envInUrl}.${fullConfig.appName}.${fullConfig.customerName}.${domainCanonical}`; // default for kubernetes and rest
|
|
@@ -37,22 +37,22 @@ export type Gcloudregion =
|
|
|
37
37
|
| "us-west3"
|
|
38
38
|
| "us-west4";
|
|
39
39
|
|
|
40
|
-
export type
|
|
41
|
-
/**
|
|
42
|
-
* the google cloud porject id
|
|
43
|
-
*/
|
|
44
|
-
projectId: string;
|
|
40
|
+
export type DeployConfigCloudRunService = {
|
|
45
41
|
/**
|
|
46
|
-
*
|
|
42
|
+
* command / entrypoint, fallsback to buildConfig.startcommand
|
|
47
43
|
*/
|
|
48
|
-
|
|
44
|
+
command?: string;
|
|
45
|
+
};
|
|
49
46
|
|
|
47
|
+
export type DeployConfigCloudRunJob = {
|
|
50
48
|
/**
|
|
51
|
-
* command
|
|
49
|
+
* command
|
|
52
50
|
*/
|
|
53
|
-
command
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
command: string;
|
|
52
|
+
|
|
53
|
+
when: "manual" | "postDeploy";
|
|
54
|
+
};
|
|
55
|
+
export type DeployConfigCloudRun = {
|
|
56
56
|
/**
|
|
57
57
|
* EXPERIMENTAL cloud run deployment.
|
|
58
58
|
*
|
|
@@ -61,19 +61,21 @@ export type DeployConfigCloudRunService = {
|
|
|
61
61
|
* Requires that cloud run is enabled on the project, as well as cloud run api and artifacts registry.
|
|
62
62
|
*/
|
|
63
63
|
type: "google-cloudrun";
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* the google cloud porject id
|
|
66
|
+
*/
|
|
67
|
+
projectId: string;
|
|
68
|
+
/**
|
|
69
|
+
* the region. Set to europe-west6 for switzerland
|
|
70
|
+
*/
|
|
71
|
+
region: Gcloudregion;
|
|
65
72
|
|
|
66
|
-
export type DeployConfigCloudRunJob = {
|
|
67
73
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* This will deploy a cloud run job. This does not do much currently, but will be later used for cronjobs
|
|
71
|
-
*
|
|
72
|
-
* Requires that cloud run is enabled on the project, as well as cloud run api and artifacts registry.
|
|
74
|
+
* whether to enable the service, defaults to true
|
|
73
75
|
*/
|
|
74
|
-
|
|
75
|
-
} & DeployConfigCloudRunBase;
|
|
76
|
+
service?: boolean | DeployConfigCloudRunService;
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
jobs?: {
|
|
79
|
+
[name: string]: DeployConfigCloudRunJob;
|
|
80
|
+
};
|
|
81
|
+
} & DeployConfigBase;
|
package/src/types/config.ts
CHANGED
|
@@ -104,6 +104,8 @@ export type EnvConfig<E extends EnvType = EnvType> = {
|
|
|
104
104
|
host?: string;
|
|
105
105
|
} & PartialDeep<DefaultEnvConfig>;
|
|
106
106
|
|
|
107
|
+
export type EnvConfigWithComponent = EnvConfig<EnvType> & ComponentConfig;
|
|
108
|
+
|
|
107
109
|
export type Env = {
|
|
108
110
|
/**
|
|
109
111
|
* local is a special env that is only used in local development
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BuildConfigGeneric, BuildConfigType } from "../build";
|
|
2
|
+
import type { DeployConfigGeneric } from "../deploy";
|
|
3
|
+
import type { DeployConfigType } from "../deploy";
|
|
4
|
+
import type { Config, EnvConfigWithComponent, EnvType } from "./config";
|
|
5
|
+
import type { CommitInfo } from "./context";
|
|
6
|
+
|
|
7
|
+
export type EnvironmentContext<
|
|
8
|
+
B extends BuildConfigType,
|
|
9
|
+
D extends DeployConfigType
|
|
10
|
+
> = {
|
|
11
|
+
envConfigRaw: EnvConfigWithComponent;
|
|
12
|
+
buildConfigRaw: false | BuildConfigGeneric<B>;
|
|
13
|
+
deployConfigRaw: false | DeployConfigGeneric<D>;
|
|
14
|
+
commitInfo?: CommitInfo;
|
|
15
|
+
env: string;
|
|
16
|
+
envType: EnvType;
|
|
17
|
+
componentName: string;
|
|
18
|
+
fullName: string;
|
|
19
|
+
environmentSlug: string;
|
|
20
|
+
gitlabEnvironmentName: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* the full catladder config
|
|
24
|
+
*/
|
|
25
|
+
fullConfig: Config;
|
|
26
|
+
};
|