@catladder/pipeline 0.0.0-fix-command-710f75f1 → 0.0.0-fix-error-sql-db-delete-b3878c2e
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/custom/buildJob.js +1 -0
- package/dist/build/docker.d.ts +4 -18
- package/dist/build/docker.js +15 -9
- package/dist/build/index.js +7 -1
- package/dist/build/rails/build.js +37 -16
- package/dist/build/rails/index.d.ts +2 -2
- package/dist/build/rails/test.js +1 -2
- package/dist/build/types.d.ts +36 -4
- package/dist/bundles/catladder-gitlab/index.js +543 -218
- package/dist/constants.js +1 -1
- package/dist/context/getEnvironment.js +1 -0
- package/dist/context/getEnvironmentContext.js +5 -3
- package/dist/context/getEnvironmentVariables.d.ts +5 -1
- package/dist/context/getEnvironmentVariables.js +7 -2
- package/dist/deploy/base.js +1 -1
- package/dist/deploy/cloudRun/index.js +14 -6
- package/dist/deploy/custom/deployJob.js +6 -3
- package/dist/deploy/index.d.ts +2 -1
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
- package/dist/deploy/kubernetes/additionalSecretKeys.js +5 -1
- package/dist/deploy/kubernetes/deployJob.js +4 -4
- 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/custom.d.ts +2 -1
- package/dist/deploy/types/googleCloudRun.d.ts +5 -1
- package/dist/deploy/types/kubernetes.d.ts +9 -0
- package/dist/pipeline/createAllJobs.d.ts +8 -0
- package/dist/pipeline/createAllJobs.js +164 -0
- package/dist/pipeline/createChildPipeline.js +24 -48
- package/dist/pipeline/createJobsForComponent.d.ts +3 -0
- package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +8 -105
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
- package/dist/pipeline/gitlab/createGitlabJobs.js +260 -0
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +3 -3
- package/dist/types/context.d.ts +3 -1
- package/dist/types/environmentContext.d.ts +7 -0
- package/dist/types/gitlab-types.d.ts +5 -1
- package/dist/types/jobs.d.ts +9 -2
- package/dist/utils/gitlab.js +1 -1
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +32 -32
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +32 -32
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +32 -32
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3116 -0
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +65 -65
- package/examples/__snapshots__/custom-build-job.ts.snap +32 -32
- package/examples/__snapshots__/custom-deploy.ts.snap +1384 -0
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +2204 -0
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +24 -24
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
- package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
- package/examples/custom-deploy.ts +25 -0
- package/examples/kubernetes-application-customization.ts +57 -0
- package/examples/kubernetes-with-cloud-sql-legacy.ts +33 -0
- package/examples/rails-k8s-with-worker.ts +95 -0
- package/package.json +1 -1
- package/src/build/custom/buildJob.ts +1 -0
- package/src/build/docker.ts +13 -6
- package/src/build/index.ts +7 -1
- package/src/build/node/cache.ts +2 -2
- package/src/build/rails/build.ts +20 -10
- package/src/build/rails/index.ts +2 -2
- package/src/build/rails/test.ts +43 -39
- package/src/build/types.ts +40 -5
- package/src/config/configruedEnvs.ts +2 -8
- package/src/context/getEnvironment.ts +1 -0
- package/src/context/getEnvironmentContext.ts +6 -6
- package/src/context/getEnvironmentVariables.ts +9 -4
- package/src/deploy/base.ts +1 -1
- package/src/deploy/cloudRun/deployJob.ts +1 -1
- package/src/deploy/cloudRun/index.ts +12 -4
- package/src/deploy/custom/deployJob.ts +9 -1
- package/src/deploy/index.ts +4 -1
- package/src/deploy/kubernetes/additionalSecretKeys.ts +1 -1
- package/src/deploy/kubernetes/deployJob.ts +2 -1
- package/src/deploy/kubernetes/kubeValues.ts +7 -5
- package/src/deploy/types/custom.ts +2 -1
- package/src/deploy/types/googleCloudRun.ts +6 -1
- package/src/deploy/types/kubernetes.ts +11 -1
- package/src/pipeline/createAllJobs.ts +38 -0
- package/src/pipeline/createChildPipeline.ts +6 -22
- package/src/pipeline/createJobsForComponent.ts +64 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +149 -0
- package/src/pipeline/index.ts +1 -1
- package/src/types/context.ts +3 -1
- package/src/types/environmentContext.ts +7 -0
- package/src/types/gitlab-types.ts +10 -3
- package/src/types/jobs.ts +11 -2
- package/src/utils/gitlab.ts +1 -1
- package/dist/pipeline/createJobs.d.ts +0 -3
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -10
- package/dist/pipeline/gitlab/makeGitlabJob.js +0 -44
- package/src/pipeline/createJobs.ts +0 -199
- package/src/pipeline/gitlab/makeGitlabJob.ts +0 -23
package/dist/constants.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5
|
-
exports.PIPELINE_IMAGE_TAG = "fix-
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "fix-error-sql-db-delete-b3878c2e" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
|
@@ -139,6 +139,7 @@ var getEnvironment = function (config, componentName, env, commitInfo) {
|
|
|
139
139
|
url: url
|
|
140
140
|
},
|
|
141
141
|
fullName: envContext.fullName,
|
|
142
|
+
slugPrefix: envContext.environmentSlugPrefix,
|
|
142
143
|
slug: envContext.environmentSlug,
|
|
143
144
|
shortName: env,
|
|
144
145
|
envVars: envVars,
|
|
@@ -4,20 +4,22 @@ exports.__esModule = true;
|
|
|
4
4
|
exports.getEnvironmentContext = void 0;
|
|
5
5
|
var getEnvConfig_1 = require("./getEnvConfig");
|
|
6
6
|
var getEnvType_1 = require("./getEnvType");
|
|
7
|
-
var
|
|
7
|
+
var getEnvironmentSlugPrefix = function (envConfig, env, commitInfo) {
|
|
8
8
|
var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
|
|
9
|
-
return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug
|
|
9
|
+
return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug) : "".concat(env);
|
|
10
10
|
};
|
|
11
11
|
var getEnvironmentContext = function (config, env, componentName, commitInfo) {
|
|
12
12
|
var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
|
|
13
13
|
var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
|
|
14
|
-
var
|
|
14
|
+
var environmentSlugPrefix = getEnvironmentSlugPrefix(envConfigRaw, env, commitInfo);
|
|
15
|
+
var environmentSlug = "".concat(environmentSlugPrefix, "-").concat(componentName);
|
|
15
16
|
var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
16
17
|
var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
|
|
17
18
|
return {
|
|
18
19
|
envConfigRaw: envConfigRaw,
|
|
19
20
|
deployConfigRaw: envConfigRaw.deploy,
|
|
20
21
|
buildConfigRaw: envConfigRaw.build,
|
|
22
|
+
environmentSlugPrefix: environmentSlugPrefix,
|
|
21
23
|
environmentSlug: environmentSlug,
|
|
22
24
|
gitlabEnvironmentName: gitlabEnvironmentName,
|
|
23
25
|
fullName: fullName,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { CommitInfo, Context } from "../types";
|
|
2
2
|
import type { Config } from "../types/config";
|
|
3
|
+
export declare type SecretEnvVar = {
|
|
4
|
+
key: string;
|
|
5
|
+
hidden?: boolean;
|
|
6
|
+
};
|
|
3
7
|
export declare const getEnvironmentVariables: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, alreadyVisited?: Record<string, Record<string, boolean>>) => Promise<{
|
|
4
8
|
envVars: Record<string, string>;
|
|
5
|
-
secretEnvVarKeys:
|
|
9
|
+
secretEnvVarKeys: SecretEnvVar[];
|
|
6
10
|
host: string;
|
|
7
11
|
url: string;
|
|
8
12
|
}>;
|
|
@@ -202,8 +202,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
202
202
|
}
|
|
203
203
|
publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
|
|
204
204
|
additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
|
|
205
|
-
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : [])
|
|
206
|
-
|
|
205
|
+
secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []).map(function (key) {
|
|
206
|
+
return {
|
|
207
|
+
key: key
|
|
208
|
+
};
|
|
209
|
+
})), false), __read(additionalSecretKeys), false);
|
|
210
|
+
secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
|
|
211
|
+
var key = _a.key;
|
|
207
212
|
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
208
213
|
}));
|
|
209
214
|
legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
|
package/dist/deploy/base.js
CHANGED
|
@@ -38,7 +38,7 @@ var getBaseDeploymentJob = function (context) {
|
|
|
38
38
|
return {
|
|
39
39
|
name: exports.DEPLOY_JOB_NAME,
|
|
40
40
|
envMode: "stagePerEnv",
|
|
41
|
-
|
|
41
|
+
needs: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
|
|
42
42
|
return {
|
|
43
43
|
componentName: c,
|
|
44
44
|
job: exports.DEPLOY_JOB_NAME,
|
|
@@ -50,15 +50,15 @@ var jobName_1 = require("./utils/jobName");
|
|
|
50
50
|
exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
|
|
51
51
|
exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
|
|
52
52
|
var getCloudSqlVariables = function (_a) {
|
|
53
|
-
var _b, _c, _d;
|
|
53
|
+
var _b, _c, _d, _e;
|
|
54
54
|
var deployConfigRaw = _a.deployConfigRaw,
|
|
55
|
-
|
|
55
|
+
environmentSlugPrefix = _a.environmentSlugPrefix,
|
|
56
56
|
env = _a.env,
|
|
57
57
|
componentName = _a.componentName,
|
|
58
58
|
fullConfig = _a.fullConfig;
|
|
59
59
|
if (deployConfigRaw && deployConfigRaw.cloudSql) {
|
|
60
|
-
var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName),
|
|
61
|
-
var additionalQueryParamsString = Object.entries((
|
|
60
|
+
var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_c = deployConfigRaw.cloudSql.dbBaseName) !== null && _c !== void 0 ? _c : componentName].filter(Boolean).join("-");
|
|
61
|
+
var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
|
|
62
62
|
var _b = __read(_a, 2),
|
|
63
63
|
key = _b[0],
|
|
64
64
|
value = _b[1];
|
|
@@ -67,7 +67,7 @@ var getCloudSqlVariables = function (_a) {
|
|
|
67
67
|
return {
|
|
68
68
|
CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
|
|
69
69
|
DB_NAME: DB_NAME,
|
|
70
|
-
DB_USER: (
|
|
70
|
+
DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
|
|
71
71
|
DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
|
|
72
72
|
DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
|
|
73
73
|
DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
|
|
@@ -90,7 +90,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
90
90
|
return {};
|
|
91
91
|
},
|
|
92
92
|
additionalSecretKeys: function (ctx) {
|
|
93
|
-
return __spreadArray([
|
|
93
|
+
return __spreadArray([{
|
|
94
|
+
key: exports.GCLOUD_DEPLOY_CREDENTIALS_KEY,
|
|
95
|
+
hidden: true
|
|
96
|
+
}, {
|
|
97
|
+
key: exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
|
|
98
|
+
hidden: true
|
|
99
|
+
}], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? [{
|
|
100
|
+
key: "DB_PASSWORD"
|
|
101
|
+
}] : []), false);
|
|
94
102
|
},
|
|
95
103
|
getAdditionalEnvVars: function (ctx) {
|
|
96
104
|
var _a;
|
|
@@ -39,7 +39,7 @@ var runner_1 = require("../../runner");
|
|
|
39
39
|
var base_1 = require("../base");
|
|
40
40
|
var types_1 = require("../types");
|
|
41
41
|
var createCustomDeployJobs = function (context) {
|
|
42
|
-
var _a, _b;
|
|
42
|
+
var _a, _b, _c;
|
|
43
43
|
var deployConfig = context.componentConfig.deploy;
|
|
44
44
|
if (deployConfig === false) {
|
|
45
45
|
return [];
|
|
@@ -50,10 +50,13 @@ var createCustomDeployJobs = function (context) {
|
|
|
50
50
|
}
|
|
51
51
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
52
52
|
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
53
|
-
return [(0, lodash_1.merge)({}, baseDeploymentJob, {
|
|
53
|
+
return __spreadArray([(0, lodash_1.merge)({}, baseDeploymentJob, {
|
|
54
54
|
image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
55
55
|
cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
|
|
56
56
|
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
|
|
57
|
-
})]
|
|
57
|
+
})], __read(deployConfig.stopScript ? [(0, lodash_1.merge)({}, (0, base_1.getBaseDeploymentStopJob)(context), {
|
|
58
|
+
image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
59
|
+
script: deployConfig.stopScript
|
|
60
|
+
})] : []), false);
|
|
58
61
|
};
|
|
59
62
|
exports.createCustomDeployJobs = createCustomDeployJobs;
|
package/dist/deploy/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SecretEnvVar } from "..";
|
|
1
2
|
import type { Context } from "../types/context";
|
|
2
3
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
3
4
|
import type { CatladderJob } from "../types/jobs";
|
|
@@ -10,7 +11,7 @@ export * from "./utils";
|
|
|
10
11
|
export declare type DeployTypeDefinition<T extends DeployConfigType> = {
|
|
11
12
|
jobs: (context: Context) => CatladderJob[];
|
|
12
13
|
defaults: (envContext: EnvironmentContext<any, T>) => PartialDeep<DeployConfigGeneric<T>>;
|
|
13
|
-
additionalSecretKeys: (envContext: EnvironmentContext<any, T>) =>
|
|
14
|
+
additionalSecretKeys: (envContext: EnvironmentContext<any, T>) => SecretEnvVar[];
|
|
14
15
|
getAdditionalEnvVars: (envContext: EnvironmentContext<any, T>) => Record<string, string | undefined | null>;
|
|
15
16
|
};
|
|
16
17
|
export declare type DeployTypes = { [T in DeployConfigType]: DeployTypeDefinition<T> };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { EnvironmentContext } from "../../types/environmentContext";
|
|
2
2
|
export declare const additionalKubernetesSecretKeys: ({
|
|
3
3
|
deployConfigRaw
|
|
4
|
-
}: EnvironmentContext<any, "kubernetes">) =>
|
|
4
|
+
}: EnvironmentContext<any, "kubernetes">) => {
|
|
5
|
+
key: string;
|
|
6
|
+
}[];
|
|
@@ -19,6 +19,10 @@ var additionalKubernetesSecretKeys = function (_a) {
|
|
|
19
19
|
keys.push("POSTGRESQL_PASSWORD");
|
|
20
20
|
keys.push("cloudsqlProxyCredentials");
|
|
21
21
|
}
|
|
22
|
-
return keys
|
|
22
|
+
return keys.map(function (key) {
|
|
23
|
+
return {
|
|
24
|
+
key: key
|
|
25
|
+
};
|
|
26
|
+
});
|
|
23
27
|
};
|
|
24
28
|
exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
|
|
@@ -51,7 +51,7 @@ var base_1 = require("../base");
|
|
|
51
51
|
var types_1 = require("../types");
|
|
52
52
|
var kubeValues_1 = require("./kubeValues");
|
|
53
53
|
var createKubernetesDeployJobs = function (context) {
|
|
54
|
-
var _a, _b;
|
|
54
|
+
var _a, _b, _c;
|
|
55
55
|
var deployConfig = context.componentConfig.deploy;
|
|
56
56
|
if (deployConfig === false) {
|
|
57
57
|
return [];
|
|
@@ -75,10 +75,10 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
75
75
|
quotingType: "'",
|
|
76
76
|
forceQuotes: true
|
|
77
77
|
}),
|
|
78
|
-
HELM_GITLAB_CHART_NAME: "the-panter-chart",
|
|
79
|
-
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((
|
|
78
|
+
HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart",
|
|
79
|
+
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : []), false).join(" "),
|
|
80
80
|
COMPONENT_NAME: context.componentName,
|
|
81
|
-
BUILD_ID: (
|
|
81
|
+
BUILD_ID: (_c = context.commitInfo) === null || _c === void 0 ? void 0 : _c.buildId
|
|
82
82
|
})
|
|
83
83
|
};
|
|
84
84
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
@@ -5,6 +5,7 @@ export declare const createKubeValues: (context: Context) => never[] | ({
|
|
|
5
5
|
public: Record<string, string>;
|
|
6
6
|
};
|
|
7
7
|
application: false | import("../types/base").AllowUnknownProps<{
|
|
8
|
+
command?: string | undefined;
|
|
8
9
|
enabled?: boolean | undefined;
|
|
9
10
|
redirects?: import("../types/base").AllowUnknownProps<{
|
|
10
11
|
host: string;
|
|
@@ -50,33 +50,36 @@ var kubeEnv_1 = require("./kubeEnv");
|
|
|
50
50
|
var mongodb_1 = require("./mongodb");
|
|
51
51
|
var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
|
|
52
52
|
var createAppConfig = function (context, application) {
|
|
53
|
-
var _a, _b, _c;
|
|
54
53
|
if (application === false) {
|
|
55
54
|
return {
|
|
56
55
|
enabled: false
|
|
57
56
|
};
|
|
58
57
|
}
|
|
58
|
+
var _a = application !== null && application !== void 0 ? application : {},
|
|
59
|
+
healthRoute = _a.healthRoute,
|
|
60
|
+
command = _a.command,
|
|
61
|
+
rest = __rest(_a, ["healthRoute", "command"]);
|
|
59
62
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
60
63
|
host: context.environment.host,
|
|
61
|
-
command: context.componentConfig.build.startCommand,
|
|
64
|
+
command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
|
|
62
65
|
livenessProbe: {
|
|
63
66
|
httpGet: {
|
|
64
|
-
path:
|
|
67
|
+
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
|
|
65
68
|
}
|
|
66
69
|
},
|
|
67
70
|
readinessProbe: {
|
|
68
71
|
httpGet: {
|
|
69
|
-
path:
|
|
72
|
+
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
|
|
70
73
|
}
|
|
71
74
|
},
|
|
72
75
|
startupProbe: {
|
|
73
76
|
httpGet: {
|
|
74
|
-
path:
|
|
77
|
+
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
},
|
|
78
81
|
// default
|
|
79
|
-
|
|
82
|
+
rest // merge rest in
|
|
80
83
|
);
|
|
81
84
|
};
|
|
82
85
|
|
|
@@ -23,6 +23,7 @@ export declare const processSecretsAsFiles: <T extends {
|
|
|
23
23
|
concurrencyPolicy?: "Forbid" | "Allow" | "Replace" | undefined;
|
|
24
24
|
}>> | undefined;
|
|
25
25
|
application?: false | import("../types/base").AllowUnknownProps<{
|
|
26
|
+
command?: string | undefined;
|
|
26
27
|
enabled?: boolean | undefined;
|
|
27
28
|
redirects?: import("../types/base").AllowUnknownProps<{
|
|
28
29
|
host: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GitlabJobImage } from "../../types";
|
|
1
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
2
3
|
import type { DeployConfigBase } from "./base";
|
|
3
4
|
export declare type DeployConfigCustom = {
|
|
@@ -24,7 +25,7 @@ export declare type DeployConfigCustom = {
|
|
|
24
25
|
/**
|
|
25
26
|
* image to use
|
|
26
27
|
*/
|
|
27
|
-
jobImage?:
|
|
28
|
+
jobImage?: GitlabJobImage;
|
|
28
29
|
/**
|
|
29
30
|
* customize cache for the job
|
|
30
31
|
*/
|
|
@@ -8,11 +8,15 @@ export declare type DeployConfigCloudRunCloudSql = {
|
|
|
8
8
|
*/
|
|
9
9
|
dbUser?: string;
|
|
10
10
|
/**
|
|
11
|
-
* the prefix of the database, the full db name is this plus the environment slug
|
|
11
|
+
* the prefix of the database, the full db name is this plus the environment slug prefix plus the componentName
|
|
12
12
|
*
|
|
13
13
|
* defaults to customerName-appName
|
|
14
14
|
*/
|
|
15
15
|
dbNamePrefix?: string | false;
|
|
16
|
+
/**
|
|
17
|
+
* the base name of the db, defaults to the componentName
|
|
18
|
+
*/
|
|
19
|
+
dbBaseName?: string;
|
|
16
20
|
/**
|
|
17
21
|
* whether to delete the database if the environment is stopped
|
|
18
22
|
* defaults to true for review envs, to false for every other environment
|
|
@@ -173,6 +173,10 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
173
173
|
* configuration for the application ("Deployment" in kubernetes)
|
|
174
174
|
*/
|
|
175
175
|
application?: false | AllowUnknownProps<{
|
|
176
|
+
/**
|
|
177
|
+
* command to start, defaults to build's startCommand
|
|
178
|
+
*/
|
|
179
|
+
command?: string;
|
|
176
180
|
/**
|
|
177
181
|
* enable, disable app deployment, defaults to true
|
|
178
182
|
*/
|
|
@@ -263,5 +267,10 @@ export declare type DeployConfigKubernetes = {
|
|
|
263
267
|
* values to configure the app
|
|
264
268
|
*/
|
|
265
269
|
values?: DeployConfigKubernetesValues;
|
|
270
|
+
/**
|
|
271
|
+
* Custom Helm chart location.
|
|
272
|
+
* Not recommended to use.
|
|
273
|
+
*/
|
|
274
|
+
chartName?: string;
|
|
266
275
|
} & DeployConfigBase;
|
|
267
276
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config, PipelineTrigger } from "../types";
|
|
2
|
+
import type { CatladderJob } from "../types/jobs";
|
|
3
|
+
export declare type AllCatladderJobs = {
|
|
4
|
+
[componentName: string]: {
|
|
5
|
+
[env: string]: Array<CatladderJob>;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare const createAllJobs: (config: Config, trigger: PipelineTrigger) => Promise<AllCatladderJobs>;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) {
|
|
5
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
+
resolve(value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.next(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function step(result) {
|
|
25
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
+
}
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
+
var _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function () {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
},
|
|
40
|
+
f,
|
|
41
|
+
y,
|
|
42
|
+
t,
|
|
43
|
+
g;
|
|
44
|
+
return g = {
|
|
45
|
+
next: verb(0),
|
|
46
|
+
"throw": verb(1),
|
|
47
|
+
"return": verb(2)
|
|
48
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
+
return this;
|
|
50
|
+
}), g;
|
|
51
|
+
function verb(n) {
|
|
52
|
+
return function (v) {
|
|
53
|
+
return step([n, v]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while (_) try {
|
|
59
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
+
switch (op[0]) {
|
|
62
|
+
case 0:
|
|
63
|
+
case 1:
|
|
64
|
+
t = op;
|
|
65
|
+
break;
|
|
66
|
+
case 4:
|
|
67
|
+
_.label++;
|
|
68
|
+
return {
|
|
69
|
+
value: op[1],
|
|
70
|
+
done: false
|
|
71
|
+
};
|
|
72
|
+
case 5:
|
|
73
|
+
_.label++;
|
|
74
|
+
y = op[1];
|
|
75
|
+
op = [0];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [6, e];
|
|
107
|
+
y = 0;
|
|
108
|
+
} finally {
|
|
109
|
+
f = t = 0;
|
|
110
|
+
}
|
|
111
|
+
if (op[0] & 5) throw op[1];
|
|
112
|
+
return {
|
|
113
|
+
value: op[0] ? op[1] : void 0,
|
|
114
|
+
done: true
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.__esModule = true;
|
|
119
|
+
exports.createAllJobs = void 0;
|
|
120
|
+
var config_1 = require("../config");
|
|
121
|
+
var createJobsForComponent_1 = require("./createJobsForComponent");
|
|
122
|
+
var createAllJobs = function (config, trigger) {
|
|
123
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
return __generator(this, function (_c) {
|
|
126
|
+
switch (_c.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
_b = (_a = Object).fromEntries;
|
|
129
|
+
return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
|
|
130
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
+
var envs, _a, _b, _c;
|
|
132
|
+
return __generator(this, function (_d) {
|
|
133
|
+
switch (_d.label) {
|
|
134
|
+
case 0:
|
|
135
|
+
envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
|
|
136
|
+
_a = [componentName];
|
|
137
|
+
_c = (_b = Object).fromEntries;
|
|
138
|
+
return [4 /*yield*/, Promise.all(envs.map(function (env) {
|
|
139
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
140
|
+
var _a;
|
|
141
|
+
return __generator(this, function (_b) {
|
|
142
|
+
switch (_b.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
_a = [env];
|
|
145
|
+
return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
|
|
146
|
+
case 1:
|
|
147
|
+
return [2 /*return*/, _a.concat([_b.sent()])];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}))];
|
|
152
|
+
case 1:
|
|
153
|
+
return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}))];
|
|
158
|
+
case 1:
|
|
159
|
+
return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
exports.createAllJobs = createAllJobs;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __assign = this && this.__assign || function () {
|
|
4
|
-
__assign = Object.assign || function (t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
3
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
14
4
|
function adopt(value) {
|
|
15
5
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -162,54 +152,40 @@ var config_1 = require("../config");
|
|
|
162
152
|
var rules_1 = require("../rules");
|
|
163
153
|
var runner_1 = require("../runner");
|
|
164
154
|
var jobs_1 = require("../types/jobs");
|
|
165
|
-
var
|
|
155
|
+
var createAllJobs_1 = require("./createAllJobs");
|
|
156
|
+
var createGitlabJobs_1 = require("./gitlab/createGitlabJobs");
|
|
166
157
|
var createChildPipeline = function (type, trigger, config) {
|
|
167
158
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
159
|
+
var jobs, allEnvs, stages, pipeline;
|
|
160
|
+
var _a;
|
|
161
|
+
return __generator(this, function (_b) {
|
|
162
|
+
switch (_b.label) {
|
|
171
163
|
case 0:
|
|
172
|
-
|
|
173
|
-
return [4 /*yield*/, components.reduce(function (acc, componentName) {
|
|
174
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
175
|
-
var envs, _a, _b;
|
|
176
|
-
return __generator(this, function (_c) {
|
|
177
|
-
switch (_c.label) {
|
|
178
|
-
case 0:
|
|
179
|
-
envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
|
|
180
|
-
_a = [{}];
|
|
181
|
-
return [4 /*yield*/, acc];
|
|
182
|
-
case 1:
|
|
183
|
-
_b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
|
|
184
|
-
return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
|
|
185
|
-
case 2:
|
|
186
|
-
return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
}, Promise.resolve({}))];
|
|
164
|
+
return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
|
|
191
165
|
case 1:
|
|
192
|
-
jobs =
|
|
166
|
+
jobs = _b.sent();
|
|
193
167
|
allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
|
|
194
168
|
stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
|
|
195
169
|
return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
|
|
196
170
|
return "".concat(baseStage, " ").concat(e);
|
|
197
171
|
})), false);
|
|
198
172
|
}, []);
|
|
199
|
-
if (type === "gitlab")
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
173
|
+
if (!(type === "gitlab")) return [3 /*break*/, 3];
|
|
174
|
+
_a = {
|
|
175
|
+
image: (0, runner_1.getRunnerImage)("jobs-default"),
|
|
176
|
+
variables: {
|
|
177
|
+
FF_USE_FASTZIP: "true"
|
|
178
|
+
},
|
|
179
|
+
workflow: {
|
|
180
|
+
rules: rules_1.RULES_ALWAYS
|
|
181
|
+
},
|
|
182
|
+
stages: stages
|
|
183
|
+
};
|
|
184
|
+
return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
|
|
185
|
+
case 2:
|
|
186
|
+
pipeline = (_a.jobs = _b.sent(), _a);
|
|
187
|
+
return [2 /*return*/, pipeline];
|
|
188
|
+
case 3:
|
|
213
189
|
throw new Error("".concat(type, " is not supported"));
|
|
214
190
|
}
|
|
215
191
|
});
|